symposion_app/docker/Dockerfile
James Polley af5fec11ff Utilise multi-stage docker build for consistent dev/prod base
* developers can use --target symposion_dev to get a responsive site
  that reads from their homedir and reacts to changed files instantly
* without a specified target the default is to build the prod image,
  which is identical except for running uwsgi instead of the django
  built-in server
* Enable debug when running in a developer's test environment
* Remove the makemigrations script and dockerfile
2017-10-04 20:43:01 +11:00

49 lines
1.3 KiB
Docker

FROM python:3.6 as symposion_base
RUN set -ex \
&& apt-get update
RUN set -ex \
&& buildDeps=' \
libmysqlclient-dev \
libffi-dev \
libfreetype6-dev \
libjpeg-dev \
libwebp-dev \
libpng-dev \
liblcms2-dev \
zlib1g-dev \
libmemcached-dev \
libsasl2-dev \
' \
&& apt-get install -y git xmlsec1 libmysqlclient18 \
&& apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& pip install uwsgi
COPY constraints.txt requirements.txt /reqs/
RUN set -ex \
&& pip install --no-cache-dir -r /reqs/requirements.txt -c /reqs/constraints.txt \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /usr/src/python ~/.cache
COPY . /app/symposion_app
WORKDIR /app/symposion_app
RUN set -x \
&& pip install -r vendored_requirements.txt -c /reqs/constraints.txt
RUN set -x \
&& DJANGO_SECRET_KEY=1234 STRIPE_PUBLIC_KEY=1234 STRIPE_SECRET_KEY=1234 \
DATABASE_URL="sqlite:////dev/null" \
python manage.py collectstatic --noinput -l -v 0
FROM symposion_base as symposion_dev
VOLUME /app/symposion_app
CMD ["./manage.py", "runserver", "-v3", "0.0.0.0:8000"]
FROM symposion_base as symposion_prod
CMD ["/usr/local/bin/uwsgi", "--http-socket", "0.0.0.0:8000", "--wsgi-file", "pinaxcon/wsgi.py"]