-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (52 loc) · 1.43 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM python:3.11-bullseye AS app
MAINTAINER [email protected]
ENV PYTHONUNBUFFERED 1 \
PIP_NO_CACHE_DIR=off
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install --no-install-recommends -y \
&& apt-get install -y gdal-bin libgeos-dev netcat \
&& pip install --upgrade pip \
&& pip install uwsgi \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN adduser --system datapunt
RUN mkdir -p /src && chown datapunt /src
RUN mkdir -p /deploy && chown datapunt /deploy
RUN mkdir -p /var/log/uwsgi && chown datapunt /var/log/uwsgi
RUN mkdir -p /media && chmod 777 /media
WORKDIR /install
ADD requirements.txt .
RUN pip install -r requirements.txt
RUN chmod -R a+r /install
WORKDIR /src
COPY src .
COPY deploy /deploy
ARG SECRET_KEY=not-used
ARG OIDC_RP_CLIENT_ID=not-used
ARG OIDC_RP_CLIENT_SECRET=not-used
RUN python manage.py collectstatic --no-input
USER datapunt
CMD ["/deploy/docker-run.sh"]
# devserver
FROM app AS dev
USER root
WORKDIR /install
ADD requirements_dev.txt .
RUN pip install -r requirements_dev.txt
WORKDIR /src
USER datapunt
# Any process that requires to write in the home dir
# we write to /tmp since we have no home dir
ENV HOME /tmp
CMD ["python manage.py runserver 0.0.0.0"]
# tests
FROM dev AS tests
USER datapunt
WORKDIR /tests
ADD tests .
COPY pyproject.toml /.
ENV COVERAGE_FILE=/tmp/.coverage
ENV PYTHONPATH=/src
# ENV USE_JWKS_TEST_KEY=True
CMD ["pytest"]