2019-04-02 23:30:05 +03:00
|
|
|
FROM python:3.7-slim
|
2017-06-15 21:32:30 +03:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
2017-06-23 15:49:32 +03:00
|
|
|
RUN useradd --uid 1000 --no-create-home --home-dir /app webdev
|
2017-06-15 21:32:30 +03:00
|
|
|
|
2017-10-27 17:40:37 +03:00
|
|
|
RUN mkdir -p \
|
|
|
|
/usr/share/man/man1 \
|
|
|
|
/usr/share/man/man2 \
|
|
|
|
/usr/share/man/man3 \
|
|
|
|
/usr/share/man/man4 \
|
|
|
|
/usr/share/man/man5 \
|
|
|
|
/usr/share/man/man6 \
|
|
|
|
/usr/share/man/man7 \
|
|
|
|
/usr/share/man/man8 && \
|
|
|
|
apt-get update && \
|
2017-08-31 23:13:52 +03:00
|
|
|
apt-get install -y --no-install-recommends build-essential libpq-dev \
|
2019-04-02 23:09:00 +03:00
|
|
|
mime-support postgresql-client gettext curl netcat && \
|
2017-09-01 00:46:16 +03:00
|
|
|
apt-get autoremove -y && \
|
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
2017-06-15 21:32:30 +03:00
|
|
|
|
|
|
|
# Using PIL or Pillow? You probably want to uncomment next line
|
|
|
|
# RUN apt-get update && apt-get install -y --no-install-recommends libjpeg8-dev
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2018-01-09 20:55:15 +03:00
|
|
|
# First copy requirements so we can take advantage of docker caching.
|
|
|
|
COPY requirements/*.txt /app/
|
2022-04-29 21:38:15 +03:00
|
|
|
|
|
|
|
# temporary workaround for the following error: ImportError: cannot import name 'Feature' from 'setuptools'
|
|
|
|
RUN pip install setuptools==45
|
|
|
|
|
2018-01-09 20:55:15 +03:00
|
|
|
RUN pip install --require-hashes --no-cache-dir -r all.txt
|
2017-06-15 21:32:30 +03:00
|
|
|
|
2017-07-26 00:08:21 +03:00
|
|
|
COPY . /app
|
2017-06-23 03:29:59 +03:00
|
|
|
RUN chown webdev:webdev -R .
|
2017-06-15 21:32:30 +03:00
|
|
|
USER webdev
|
2017-06-23 03:29:59 +03:00
|
|
|
|
2017-07-05 21:34:15 +03:00
|
|
|
RUN DEBUG=False SECRET_KEY=foo ALLOWED_HOSTS=localhost, PRESTO_URL=foo DATABASE_URL=sqlite:// ./manage.py collectstatic --noinput -c
|
|
|
|
|
|
|
|
# Generate gzipped versions of files that would benefit from compression, that
|
|
|
|
# WhiteNoise can then serve in preference to the originals. This is required
|
|
|
|
# since WhiteNoise's Django storage backend only gzips assets handled by
|
|
|
|
# collectstatic, and so does not affect files in the `dist/` directory.
|
|
|
|
RUN python -m whitenoise.compress dist
|
|
|
|
|
2017-06-23 03:29:59 +03:00
|
|
|
# Using /bin/bash as the entrypoint works around some volume mount issues on Windows
|
|
|
|
# where volume-mounted files do not have execute bits set.
|
|
|
|
# https://github.com/docker/compose/issues/2301#issuecomment-154450785 has additional background.
|
|
|
|
ENTRYPOINT ["/bin/bash", "/app/bin/run"]
|
|
|
|
|
|
|
|
CMD ["web"]
|