@@ -9,7 +9,7 @@ ARG PYTHON_VERSION=python-version-not-set
99FROM python:${PYTHON_VERSION}-slim-bookworm AS uwsgi-compile
1010ENV _UWSGI_VERSION=2.0.29
1111RUN apt-get update && apt-get --no-install-recommends install -y build-essential wget && rm -rf /var/lib/apt/lists/*
12- RUN wget -O uwsgi-${_UWSGI_VERSION}.tar.gz https://github.com/unbit/uwsgi/archive/${_UWSGI_VERSION}.tar.gz \
12+ RUN wget --progress=dot:giga - O uwsgi-${_UWSGI_VERSION}.tar.gz https://github.com/unbit/uwsgi/archive/${_UWSGI_VERSION}.tar.gz \
1313 && tar zxvf uwsgi-*.tar.gz \
1414 && UWSGI_BIN_NAME=/uwsgi make -C uwsgi-${_UWSGI_VERSION} \
1515 && rm -Rf uwsgi-*
@@ -56,8 +56,8 @@ ENV PATH="/code/.venv/bin:$PATH"
5656WORKDIR /code/src
5757
5858USER web
59- RUN python manage.py compilemessages
60- RUN python manage.py collectstatic --noinput
59+ RUN python manage.py compilemessages \
60+ && python manage.py collectstatic --noinput
6161
6262# Also to mark that when CMD is used in shell form, it is a conscious decision
6363SHELL ["/bin/bash" , "-c" ]
@@ -67,32 +67,15 @@ FROM 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
70- CMD python manage.py migrate \
71- && uwsgi \
72- --master \
73- --http=:8000 \
74- --venv=/code/.venv/ \
75- --wsgi=app.wsgi \
76- --workers=2 \
77- --threads=2 \
78- --harakiri=25 \
79- --max-requests=1000 \
80- --log-x-forwarded-for
70+ CMD ["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" ]
8171
8272FROM base AS worker
8373
8474ENV _CELERY_APP=app.celery
8575HEALTHCHECK --interval=15s --timeout=15s --start-period=5s --retries=3 \
8676 CMD celery --app=${_CELERY_APP} inspect ping --destination=celery@$HOSTNAME
8777
88- CMD celery \
89- --app=${_CELERY_APP} \
90- worker \
91- --concurrency=${CONCURENCY:-2} \
92- --hostname="celery@%h" \
93- --max-tasks-per-child=${MAX_REQUESTS_PER_CHILD:-50} \
94- --time-limit=${TIME_LIMIT:-900} \
95- --soft-time-limit=${SOFT_TIME_LIMIT:-45}
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}" ]
9679
9780
9881FROM base AS scheduler
@@ -105,8 +88,4 @@ VOLUME ${_SCHEDULER_DB_PATH}
10588
10689ENV _CELERY_APP=app.celery
10790HEALTHCHECK NONE
108- CMD celery \
109- --app=${_CELERY_APP} \
110- beat \
111- --pidfile=/tmp/celerybeat.pid \
112- --schedule=${_SCHEDULER_DB_PATH}/celerybeat-schedule.db
91+ CMD ["celery" , "--app=${_CELERY_APP}" , "beat" , "--pidfile=/tmp/celerybeat.pid" , "--schedule=${_SCHEDULER_DB_PATH}/celerybeat-schedule.db" ]
0 commit comments