-
Notifications
You must be signed in to change notification settings - Fork 182
/
Dockerfile
41 lines (31 loc) · 1.36 KB
/
Dockerfile
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
38
39
40
41
FROM python:3.11.10
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}
RUN pip install --no-cache --upgrade pip
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
COPY --chown=app ./requirements.txt /app/requirements.txt
RUN pip install --no-cache -r requirements.txt
COPY --chown=app . /app
# 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.
RUN ln --symbolic /app/privaterelay/locales/fy-NL/ privaterelay/locales/fy
RUN ln --symbolic /app/privaterelay/locales/sv-SE/ privaterelay/locales/sv
RUN ln --symbolic /app/privaterelay/locales/pt-BR/ privaterelay/locales/pt
RUN ln --symbolic /app/privaterelay/locales/es-ES/ privaterelay/locales/es
COPY --chown=app .env-dist /app/.env
# Collect all staticfiles, including for apps that may be disabled
RUN PHONES_ENABLED=True \
API_DOCS_ENABLED=True \
mkdir -p /app/staticfiles && \
python manage.py collectstatic --no-input -v 2
ENTRYPOINT ["/app/.local/bin/gunicorn"]
CMD ["--config", "gunicorn.conf.py", "privaterelay.wsgi:application"]