-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
53 lines (39 loc) · 1.48 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
# ==============================
FROM helsinkitest/python:3.9-slim as appbase
# ==============================
RUN mkdir /entrypoint
COPY --chown=appuser:appuser requirements.txt /app/requirements.txt
RUN apt-install.sh \
git \
netcat-openbsd \
libpq-dev \
build-essential \
gdal-bin \
python3-gdal \
&& pip install -U pip setuptools wheel \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& apt-cleanup.sh build-essential
COPY --chown=appuser:appuser docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
ENTRYPOINT ["/entrypoint/docker-entrypoint.sh"]
EXPOSE 8000/tcp
# ==============================
FROM appbase as development
# ==============================
COPY --chown=appuser:appuser requirements-dev.txt /app/requirements-dev.txt
RUN apt-install.sh \
build-essential \
&& pip install --no-cache-dir -r /app/requirements-dev.txt \
&& apt-cleanup.sh build-essential
ENV DEV_SERVER=1
COPY --chown=appuser:appuser . /app/
# django-munigeo municipality importer requires this
RUN mkdir -p /app/data && chgrp -R 0 /app/data && chmod g+w -R /app/data
USER appuser
# ==============================
FROM appbase as production
# ==============================
COPY --chown=appuser:appuser . /app/
# django-munigeo municipality importer requires this
RUN mkdir -p /app/data && chgrp -R 0 /app/data && chmod g+w -R /app/data
RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic
USER appuser