@@ -59,25 +59,30 @@ USER web
5959RUN python manage.py compilemessages \
6060 && python manage.py collectstatic --noinput
6161
62- # Also to mark that when CMD is used in shell form, it is a conscious decision
63- SHELL ["/bin/bash" , "-c" ]
64-
6562
63+ #
64+ # web image
65+ #
6666FROM base AS web
6767HEALTHCHECK --interval=15s --timeout=15s --start-period=15s --retries=3 \
6868 CMD wget --quiet --tries=1 --spider http://localhost:8000/api/v1/healthchecks/
6969
7070CMD ["sh" , "-c" , "python manage.py migrate && uwsgi --master --http=:8000 --venv=/code/.venv/ --wsgi=app.wsgi --workers=2 --threads=2 --harakiri=25 --max-requests=1000 --log-x-forwarded-for" ]
7171
72+ #
73+ # worker image
74+ #
7275FROM base AS worker
7376
7477ENV _CELERY_APP=app.celery
7578HEALTHCHECK --interval=15s --timeout=15s --start-period=5s --retries=3 \
7679 CMD celery --app=${_CELERY_APP} inspect ping --destination=celery@$HOSTNAME
7780
78- CMD ["celery" , "--app=${_CELERY_APP}" , "worker" , "--concurrency=${CONCURENCY:-2}" , "--hostname=celery@%h" , "--max-tasks-per-child=${MAX_REQUESTS_PER_CHILD:-50}" , "--time-limit=${TIME_LIMIT:-900}" , "--soft-time-limit=${SOFT_TIME_LIMIT:-45}" ]
79-
81+ CMD ["sh" , "-c" , "celery --app=${_CELERY_APP} worker --concurrency=${CONCURENCY:-2} --hostname=celery@%h --max-tasks-per-child=${MAX_REQUESTS_PER_CHILD:-50} --time-limit=${TIME_LIMIT:-900} --soft-time-limit=${SOFT_TIME_LIMIT:-45}" ]
8082
83+ #
84+ # scheduler image
85+ #
8186FROM base AS scheduler
8287
8388ENV _SCHEDULER_DB_PATH=/var/db/scheduler
@@ -88,4 +93,4 @@ VOLUME ${_SCHEDULER_DB_PATH}
8893
8994ENV _CELERY_APP=app.celery
9095HEALTHCHECK NONE
91- CMD ["celery " , "-- app=${_CELERY_APP}" , " beat" , " --pidfile=/tmp/celerybeat.pid" , " --schedule=${_SCHEDULER_DB_PATH}/celerybeat-schedule.db" ]
96+ CMD ["sh " , "-c" , "celery -- app=${_CELERY_APP} beat --pidfile=/tmp/celerybeat.pid --schedule=${_SCHEDULER_DB_PATH}/celerybeat-schedule.db" ]
0 commit comments