-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
64 lines (45 loc) · 1.54 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
# ==============================
FROM helsinkitest/python:3.8-slim AS appbase
# ==============================
ENV PYTHONUNBUFFERED 1
WORKDIR /app
RUN mkdir /entrypoint
COPY --chown=appuser:appuser requirements*.txt /app/
RUN apt-install.sh \
build-essential \
pkg-config \
libpq-dev \
gettext \
gdal-bin \
netcat-openbsd \
python3-gdal \
postgresql-client \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& pip install --no-cache-dir -r /app/requirements-prod.txt \
&& apt-cleanup.sh build-essential pkg-config
COPY --chown=appuser:appuser deploy/docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
ENTRYPOINT ["/entrypoint/docker-entrypoint.sh"]
# ==============================
FROM appbase AS staticbuilder
# ==============================
ENV VAR_ROOT /app
COPY --chown=appuser:appuser . /app
RUN python manage.py compilemessages
RUN python manage.py collectstatic --noinput
# ==============================
FROM appbase AS development
# ==============================
COPY --chown=appuser:appuser requirements-dev.txt /app/requirements-dev.txt
RUN pip install --no-cache-dir -r /app/requirements-dev.txt
ENV DEV_SERVER=1
COPY --chown=appuser:appuser . /app/
USER appuser
EXPOSE 8080/tcp
# ==============================
FROM appbase AS production
# ==============================
COPY --from=staticbuilder --chown=appuser:appuser /app/static /app/static
COPY --from=staticbuilder --chown=appuser:appuser /app/locale /app/locale
COPY --chown=appuser:appuser . /app/
USER appuser
EXPOSE 8080/tcp