Skip to content

Commit a8b5d7a

Browse files
committed
publish the docker image
1 parent 44c3ac3 commit a8b5d7a

File tree

6 files changed

+84
-12
lines changed

6 files changed

+84
-12
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
services: docker
22

3+
env:
4+
global:
5+
- DOCKER_USERNAME: planetdatalake
6+
- secure: cF1f4bTOi52fyPcsJnaOOr33ghNZUQPnHEOwtXaRX0fZ1X6mRW9XrFOaMScZOhWEIlV7RteuEIoxIaJVN8ZWKHVZIh7/815quUmcOMhTRboHHMnGQPaXDYEmmhbPEg1uxjKTrGBRD5L/KZ2XUFqkobgb17Ju1QAH+K91hJJ6qes=
7+
38
_python_template: &_python_template
49
language: python
510
stage: test
@@ -40,3 +45,10 @@ jobs:
4045
stage: test
4146
script:
4247
- make test
48+
deploy:
49+
provider: script
50+
script:
51+
- make push
52+
on:
53+
branch: master
54+
repo: planetlabs/datalake

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ COPY . /opt/
4545
# the container and used for development. That is, the python paths and paths
4646
# to console scripts Just Work (TM)
4747
ENV PYTHONPATH=/opt/common:/opt/client:/opt/ingester:/opt/api
48-
RUN cd /opt/client && \
48+
RUN for d in client ingester api; do \
49+
cd /opt/$d && \
4950
python setup.py develop -s /usr/local/bin \
50-
--egg-path ../../../../../opt/client/ \
51+
--egg-path ../../../../../opt/$d/ \
5152
-d /usr/local/lib/python2.7/site-packages/ \
52-
--no-deps;
53+
--no-deps; \
54+
done
5355

5456
ARG VERSION=unspecified
5557
ENV VERSION=$VERSION
5658

5759
WORKDIR /opt
58-
ENTRYPOINT ["/usr/local/bin/datalake"]
60+
ENTRYPOINT ["/opt/docker_entry.sh"]

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
VERSION=$(shell git describe --tags --dirty)
2+
REPO=planetlabs
3+
IMAGE="$(REPO)/datalake:$(VERSION)"
24

35
.PHONY: docker # build the docker container
46
docker:
5-
docker build --build-arg VERSION=$(VERSION) -t datalake:$(VERSION) .
7+
docker build --build-arg VERSION=$(VERSION) -t $(IMAGE) .
68

79
.PHONY: devshell # Open a developer shell in the docker env
810
devshell: docker
9-
docker run --rm -it -v $$PWD:/opt --entrypoint /bin/bash datalake:$(VERSION)
11+
docker run --rm -it -v $$PWD:/opt --entrypoint /bin/bash $(IMAGE)
1012

1113
.PHONY: test # Run the tests
12-
1314
test: docker
1415
echo VERSION=$(VERSION)
1516
for p in common client ingester api; do \
16-
docker run --rm -it --entrypoint py.test datalake:$(VERSION) $$p; \
17+
docker run --rm -it --entrypoint py.test $(IMAGE) $$p; \
1718
done
1819

20+
.PHONY: push
21+
push:
22+
ifeq ($(DOCKER_USERNAME),)
23+
echo "You must set DOCKER_USERNAME"
24+
exit 1
25+
endif
26+
ifeq ($(DOCKER_PASSWORD),)
27+
echo "You must set DOCKER_PASSWORD"
28+
exit 1
29+
endif
30+
echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin && \
31+
docker push $(IMAGE)
32+
1933
.PHONY: help # Generate list of targets with descriptions
2034
help:
2135
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/ \1: \2/' | expand -t20

api/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def get_version():
5454
'pyver>=1.0.18',
5555
'memoized_property>=1.0.2',
5656
'simplejson>=3.3.1',
57-
'datalake-common>=0.25',
5857
'Flask>=0.10.1',
5958
'flask-swagger==0.2.8',
6059
'boto3==1.1.3',

docker_entry.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
HERE=$(cd `dirname "$0"` && pwd)
4+
5+
usage() {
6+
cat <<EOF
7+
datalake docker entry script
8+
9+
Usage: docker_entry.sh <command> <args>
10+
11+
Valid commands include:
12+
13+
help: print this message
14+
15+
datalake: the datalake client
16+
17+
api: the datalake API server
18+
19+
ingester: the datalake ingester
20+
21+
EOF
22+
}
23+
24+
case "$1" in
25+
"help")
26+
usage
27+
;;
28+
"datalake")
29+
shift
30+
/usr/local/bin/datalake "$@"
31+
;;
32+
"api")
33+
shift
34+
FLASK_APP=/opt/api/datalake_api/app.py flask run "$@"
35+
;;
36+
"ingester")
37+
shift
38+
/usr/local/bin/datalake_tool "$@"
39+
;;
40+
"")
41+
echo "ERROR: Please specify a command."
42+
usage
43+
exit 1
44+
;;
45+
*)
46+
usage
47+
exit 1
48+
esac

ingester/setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ def get_version():
5151
author_email='[email protected]',
5252
packages=['datalake_ingester'],
5353
install_requires=[
54-
'pyver>=1.0.18',
5554
'boto>=2.38.0',
56-
'configargparse>=0.9.3',
5755
'memoized_property>=1.0.2',
5856
'simplejson>=3.3.1',
59-
'datalake-common>=0.26',
6057
'raven>=5.6.0',
6158
'click>=5.1',
6259
],

0 commit comments

Comments
 (0)