Skip to content

Instantly share code, notes, and snippets.

@f213
Created May 25, 2019 17:09
Show Gist options
  • Save f213/4d6cda280364ca40001e2130401879b2 to your computer and use it in GitHub Desktop.
Save f213/4d6cda280364ca40001e2130401879b2 to your computer and use it in GitHub Desktop.
Complex django dockerfile
version: '3.6'
services:
django:
image: gdml/backend-built-with-previous-dockerfile
volumes: &volumes
- ./src:/srv
command: ["dockerize", "-wait", "tcp://postgres:5432", "-timeout", "300s", "./manage.py", "runserver", "0.0.0.0:8000"]
FROM gdml/django-base:1.0.8 as base
WORKDIR /srv
ADD . /srv/
RUN ./manage.py compilemessages
VOLUME /srv
HEALTHCHECK CMD wget -q -O /dev/null http://localhost:8000/healthchecks/####/ --header "Host: ###.gdml.ru" || exit 1
CMD uwsgi --http :8000 --module app.wsgi --workers 2 --threads 2 --harakiri 40 --max-requests 500 --buffer-size 65545
FROM base as celery
ENV QUEUE=default
HEALTHCHECK CMD celery -A app inspect ping -d $QUEUE@$HOSTNAME
CMD celery -A app worker -Q $QUEUE -c ${CONCURENCY:-2} -n "${QUEUE}@%h" --max-tasks-per-child ${MAX_REQUESTS_PER_CHILD:-50} --time-limit ${TIME_LIMIT:-900} --soft-time-limit ${SOFT_TIME_LIMIT:-45}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment