mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-30 05:24:01 +03:00
59cd5b4849
* Celery jinja condition in .gitignore * Celery jinja conditions in Django Dockerfiles * Re-phrase Django Dockerfile requirements comments * Remove celery compose dirs through post_gen_project.py
49 lines
1.3 KiB
Docker
49 lines
1.3 KiB
Docker
FROM python:3.6-alpine
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
RUN apk update \
|
|
# psycopg2 dependencies
|
|
&& apk add --virtual build-deps gcc python3-dev musl-dev \
|
|
&& apk add postgresql-dev \
|
|
# Pillow dependencies
|
|
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
|
|
# CFFI dependencies
|
|
&& apk add libffi-dev openssl-dev py-cffi
|
|
|
|
RUN addgroup -S django \
|
|
&& adduser -S -G django django
|
|
|
|
# Requirements are installed here to ensure they will be cached.
|
|
COPY ./requirements /requirements
|
|
RUN pip install --no-cache-dir -r /requirements/production.txt \
|
|
&& rm -rf /requirements
|
|
|
|
COPY ./compose/production/django/gunicorn.sh /gunicorn.sh
|
|
RUN sed -i 's/\r//' /gunicorn.sh
|
|
RUN chmod +x /gunicorn.sh
|
|
RUN chown django /gunicorn.sh
|
|
|
|
COPY ./compose/production/django/entrypoint.sh /entrypoint.sh
|
|
RUN sed -i 's/\r//' /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
RUN chown django /entrypoint.sh
|
|
{% if cookiecutter.use_celery == "y" %}
|
|
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh
|
|
RUN sed -i 's/\r//' /start-celeryworker.sh
|
|
RUN chmod +x /start-celeryworker.sh
|
|
|
|
COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh
|
|
RUN sed -i 's/\r//' /start-celerybeat.sh
|
|
RUN chmod +x /start-celerybeat.sh
|
|
{% endif %}
|
|
COPY . /app
|
|
|
|
RUN chown -R django /app
|
|
|
|
USER django
|
|
|
|
WORKDIR /app
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|