Dockerfile for Django-Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6-stretch | |
ARG DJANGO_ENV=dev | |
ENV PYTHONUNBUFFERED 1 | |
# Requirements have to be pulled and installed here, otherwise caching won't work | |
COPY ./requirements/base.txt /base.txt | |
COPY ./requirements/cloud_production.txt /cloud_production.txt | |
COPY ./requirements/${DJANGO_ENV}.txt /requirements_${DJANGO_ENV}.txt | |
RUN apt-get update \ | |
&& apt-get install -y apt-utils libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev python-setuptools python-dev build-essential python3-all-dev python3-dev gdal-bin libgdal-dev python3-gdal git gettext \ | |
&& pip install -r /requirements_${DJANGO_ENV}.txt \ | |
&& pip install psycopg2-binary \ | |
&& groupadd -r django \ | |
&& useradd -m -r -g django django | |
COPY ./entrypoint.sh /entrypoint.sh | |
RUN sed -i 's/\r//' /entrypoint.sh | |
RUN chmod +x /entrypoint.sh | |
COPY . /app | |
RUN chown -R django /app | |
COPY ./start_wsgi_server.sh /start_wsgi_server.sh | |
RUN sed -i 's/\r//' /start_wsgi_server.sh \ | |
&& chmod +x /start_wsgi_server.sh \ | |
&& chown django /start_wsgi_server.sh | |
WORKDIR /app | |
RUN mkdir /data \ | |
&& chown django.django /data | |
RUN mkdir /data/static \ | |
&& chown django.django /data/static | |
RUN mkdir /data/media \ | |
&& chown django.django /data/media | |
ENTRYPOINT ["/entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment