-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (46 loc) · 1.22 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
FROM python:3.11-bullseye as app
ENV PYTHONUNBUFFERED 1 \
PIP_NO_CACHE_DIR=off
ENV CONSUL_HOST=${CONSUL_HOST:-notset}
ENV CONSUL_PORT=${CONSUL_PORT:-8500}
ARG USE_JWKS_TEST_KEY=true
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install --no-install-recommends -y \
gdal-bin postgresql-client \
&& pip install --upgrade pip \
&& pip install uwsgi \
&& useradd --user-group --system datapunt \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app_install
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
ADD deploy /deploy
WORKDIR /src
ADD src .
ARG SECRET_KEY=collectstatic
RUN python manage.py collectstatic --no-input
USER datapunt
CMD ["/deploy/docker-run.sh"]
# devserver
FROM app as dev
USER root
WORKDIR /app_install
ADD requirements_dev.txt requirements_dev.txt
RUN pip install -r requirements_dev.txt
RUN chmod -R a+r /app_install
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 ["./manage.py", "runserver", "0.0.0.0"]
# tests
FROM dev as tests
USER datapunt
WORKDIR /src
COPY pyproject.toml /.
ENV COVERAGE_FILE=/tmp/.coverage
ENV PYTHONPATH=/src
CMD ["pytest"]