forked from City-of-Helsinki/maritime-maas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 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
# ==============================
FROM helsinkitest/python:3.8-slim as appbase
# ==============================
RUN mkdir /entrypoint
COPY --chown=appuser:appuser requirements.txt /app/requirements.txt
COPY --chown=appuser:appuser requirements-prod.txt /app/requirements-prod.txt
RUN apt-install.sh \
build-essential \
libpq-dev \
netcat \
gdal-bin \
python3-gdal \
&& pip install -U pip \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& pip install --no-cache-dir -r /app/requirements-prod.txt \
&& apt-cleanup.sh build-essential
COPY --chown=appuser:appuser docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
ENTRYPOINT ["/entrypoint/docker-entrypoint.sh"]
# ==============================
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 8081/tcp
# ==============================
FROM appbase as staticbuilder
# ==============================
ENV VAR_ROOT /app
COPY --chown=appuser:appuser . /app
RUN python manage.py collectstatic --noinput
# ==============================
FROM appbase as production
# ==============================
COPY --from=staticbuilder --chown=appuser:appuser /app/static /app/static
COPY --chown=appuser:appuser . /app/
USER appuser
EXPOSE 8000/tcp