Skip to content

Commit

Permalink
Refactor docker build
Browse files Browse the repository at this point in the history
- Use QGIS Desktop 2.18
- Use entrypoint docker build command
  • Loading branch information
lucernae committed Jun 13, 2018
1 parent a41a35f commit 8ad324c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deployment/ansible/development/group_vars/all.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inasafe:
depth: 1

inasafe_headless_worker:
command: /docker-entrypoint.sh dev
command: dev
# Settings to specify broker url manually
broker_url:
# Optional settings to specify path mount
Expand Down
2 changes: 1 addition & 1 deletion deployment/ansible/development/group_vars/all.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inasafe:
depth: 1

inasafe_headless_worker:
command: /docker-entrypoint.sh prod inasafe-headless-worker
command: prod inasafe-headless-worker
environment:
task_always_eager: "${TASK_ALWAYS_EAGER}"
on_travis: "${ON_TRAVIS}"
Expand Down
5 changes: 3 additions & 2 deletions deployment/docker-headless/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
FROM kartoza/qgis-desktop:LTR
FROM kartoza/qgis-desktop:2.18

RUN apt-get -y update; apt-get -y --force-yes install pwgen git inotify-tools

Expand Down Expand Up @@ -37,4 +37,5 @@ ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# Environment variable
CMD ["/docker-entrypoint.sh", "prod", "inasafe-headless-worker"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["prod", "inasafe-headless-worker"]
2 changes: 2 additions & 0 deletions deployment/docker-headless/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ if [ $# -eq 2 ] && [ $1 = "prod" ] && [ $2 = "inasafe-headless-worker" ]; then
elif [ $# -eq 1 ] && [ $1 = "dev" ]; then
/usr/sbin/sshd -D
fi

exec "$@"
5 changes: 3 additions & 2 deletions deployment/production/docker/headless/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
FROM kartoza/qgis-desktop:LTR
FROM kartoza/qgis-desktop:2.18

RUN apt-get -y update; apt-get -y --force-yes install pwgen git inotify-tools

Expand Down Expand Up @@ -33,4 +33,5 @@ ARG INASAFE_HEADLESS_TAG=develop
RUN git clone --branch ${INASAFE_HEADLESS_TAG} --depth 1 https://github.com/inasafe/inasafe-headless.git source
RUN ln -s source/src/headless headless

CMD ["/docker-entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["prod", "inasafe-headless-worker"]
8 changes: 7 additions & 1 deletion deployment/production/docker/headless/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ done

cp -n /home/app/headless/celeryconfig_sample.py /home/app/headless/celeryconfig.py

/usr/local/bin/celery -A headless.celery_app worker -l info -Q inasafe-headless -n inasafe-headless.%h
if [ $# -eq 2 ] && [ $1 = "prod" ] && [ $2 = "inasafe-headless-worker" ]; then
/usr/local/bin/celery -A headless.celery_app worker -l info -Q inasafe-headless -n inasafe-headless.%h
elif [ $# -eq 1 ]; then
/usr/local/bin/celery -A headless.celery_app worker -l info -Q inasafe-headless -n inasafe-headless.%h
fi

exec "$@"

0 comments on commit 8ad324c

Please sign in to comment.