2018-07-04 03:37:18 +00:00
|
|
|
FROM python:3.6-stretch as symposion_base
|
2017-09-27 08:31:53 +00:00
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& apt-get update
|
2017-04-29 10:17:41 +00:00
|
|
|
RUN set -ex \
|
|
|
|
&& buildDeps=' \
|
|
|
|
libffi-dev \
|
|
|
|
libfreetype6-dev \
|
|
|
|
libjpeg-dev \
|
|
|
|
libwebp-dev \
|
|
|
|
libpng-dev \
|
|
|
|
liblcms2-dev \
|
|
|
|
zlib1g-dev \
|
|
|
|
libmemcached-dev \
|
|
|
|
libsasl2-dev \
|
|
|
|
' \
|
2018-05-26 01:56:24 +00:00
|
|
|
&& apt-get install -y git xmlsec1 \
|
2017-04-29 10:17:41 +00:00
|
|
|
&& apt-get install -y $buildDeps --no-install-recommends \
|
2017-09-27 08:31:53 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& pip install uwsgi
|
|
|
|
|
|
|
|
COPY constraints.txt requirements.txt /reqs/
|
|
|
|
|
|
|
|
RUN set -ex \
|
2017-04-29 10:17:41 +00:00
|
|
|
&& 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
|
2017-09-29 13:13:37 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& pip install -r vendored_requirements.txt -c /reqs/constraints.txt
|
Improved handling of static/build and css generation
When the container is mounted, the local contents of . obscure
/app/symposion_app in the image.
Generally speaking, this is handy for development, as it means that
local changes are detected and used immediately without needing to
restart the container.
However, it breaks in the specific case of the sass->css
generation. Prior to this change, the css is generated only after the
first time a page is hit. The generated file is placed in
static/build; however, due to the obscuration, this generated file
isn't visible to the running process.
The next time the container is built, the pre-existing static/build
directory is copied into the container as it's being built; then,
later, that version is what gets served.
This change adds the needed libraries to pre-generate the css as part
of the image build, and runs compilescss to do this, prior to the
collectstatic step.
It also adds a second collectstatic into the make_dev_container
script, so that the visible static/build directory should ahve the
same contents as the obscured static/build directory. It also expands
the .dockerignore file to make sure these files aren't copied into the
image in future.
I'm not sure if this is the right thing to do, as changes to this
directory will be ignored, which could be confusing. Perhaps never
being able to see these generated files is better?
2018-06-06 02:11:51 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& DJANGO_SECRET_KEY=1234 STRIPE_PUBLIC_KEY=1234 STRIPE_SECRET_KEY=1234 \
|
|
|
|
DATABASE_URL="sqlite:////dev/null" python manage.py compilescss
|
2017-06-26 11:11:15 +00:00
|
|
|
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
|
2017-12-26 12:57:25 +00:00
|
|
|
RUN set -ex \
|
|
|
|
&& cp static/build/fonts/*.ttf /usr/local/share/fonts/ \
|
|
|
|
&& fc-cache \
|
|
|
|
&& fc-list
|
2017-10-01 07:35:02 +00:00
|
|
|
|
|
|
|
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
|
2017-10-04 13:38:05 +00:00
|
|
|
CMD ["/usr/local/bin/uwsgi", "--http-socket", "0.0.0.0:8000", "-b", "8192", "--wsgi-file", "pinaxcon/wsgi.py"]
|