1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-alpine as python
FROM python AS python-build-stage
RUN apk update \
&& apk add --virtual build-dependencies \
build-base
COPY ./docs/requirements.txt /requirements.txt
RUN pip wheel --wheel-dir /usr/src/app/wheels \
-r /requirements.txt
FROM python AS python-run-stage
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
&& rm -rf /wheels/
COPY ./compose/local/docs/start /start
RUN sed -i 's/\r//' /start
RUN chmod +x /start
RUN addgroup --system django \
&& adduser --system --ingroup django django
RUN mkdir /docs
RUN chown django:django /app
RUN chown django:django /docs
USER django
|