2024-03-26 21:29:16 +03:00
|
|
|
FROM python:3.11.8
|
2020-03-05 00:02:08 +03:00
|
|
|
|
2022-02-25 22:58:46 +03:00
|
|
|
ARG CIRCLE_BRANCH
|
|
|
|
ARG CIRCLE_SHA1
|
|
|
|
ARG CIRCLE_TAG
|
|
|
|
ENV CIRCLE_BRANCH=${CIRCLE_BRANCH:-unknown} \
|
|
|
|
CIRCLE_TAG=${CIRCLE_TAG:-unknown} \
|
|
|
|
CIRCLE_SHA1=${CIRCLE_SHA1:-unknown}
|
|
|
|
|
2022-03-25 22:11:19 +03:00
|
|
|
RUN pip install --no-cache --upgrade pip
|
2020-03-05 00:02:08 +03:00
|
|
|
|
|
|
|
RUN groupadd --gid 10001 app && \
|
|
|
|
useradd -g app --uid 10001 --shell /usr/sbin/nologin --create-home --home-dir /app app
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
USER app
|
|
|
|
|
2020-10-22 20:14:44 +03:00
|
|
|
COPY --chown=app ./requirements.txt /app/requirements.txt
|
2022-03-25 22:11:19 +03:00
|
|
|
RUN pip install --no-cache -r requirements.txt
|
2020-10-22 20:14:44 +03:00
|
|
|
COPY --chown=app . /app
|
2022-03-11 13:31:16 +03:00
|
|
|
# When the user's Accept-Language is set to `fy`, Django's LocaleMiddleware
|
|
|
|
# doesn't load `fy-NL`. This is a workaround to force the Frysian and Swedish
|
|
|
|
# localisations to load anyway when appropriate.
|
2022-03-11 14:19:06 +03:00
|
|
|
RUN ln --symbolic /app/privaterelay/locales/fy-NL/ privaterelay/locales/fy
|
|
|
|
RUN ln --symbolic /app/privaterelay/locales/sv-SE/ privaterelay/locales/sv
|
2022-03-24 15:42:30 +03:00
|
|
|
RUN ln --symbolic /app/privaterelay/locales/pt-BR/ privaterelay/locales/pt
|
|
|
|
RUN ln --symbolic /app/privaterelay/locales/es-ES/ privaterelay/locales/es
|
2020-10-22 20:14:44 +03:00
|
|
|
COPY --chown=app .env-dist /app/.env
|
2020-03-05 00:02:08 +03:00
|
|
|
|
2022-11-17 01:40:10 +03:00
|
|
|
# Collect all staticfiles, including for apps that may be disabled
|
|
|
|
RUN PHONES_ENABLED=True \
|
|
|
|
API_DOCS_ENABLED=True \
|
|
|
|
mkdir -p /app/staticfiles && \
|
2022-03-25 22:43:02 +03:00
|
|
|
python manage.py collectstatic --no-input -v 2
|
2020-04-07 20:23:08 +03:00
|
|
|
|
2020-03-06 00:16:46 +03:00
|
|
|
ENTRYPOINT ["/app/.local/bin/gunicorn"]
|
|
|
|
|
2024-07-16 23:04:45 +03:00
|
|
|
CMD ["--config", "gunicorn.conf.py", "privaterelay.wsgi:application"]
|