forked from City-of-Helsinki/city-infrastructure-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (60 loc) · 2.06 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
# ==============================
FROM python:3.8-slim AS base
# ==============================
LABEL vendor="Anders Innovations Oy"
ENV PYTHONUNBUFFERED 1
RUN mkdir /city-infrastructure-platform && \
mkdir /map-view && \
groupadd -g 1000 appuser && \
useradd -u 1000 -g appuser -ms /bin/bash appuser
WORKDIR /city-infrastructure-platform
COPY requirements.txt /city-infrastructure-platform/
COPY requirements-prod.txt /city-infrastructure-platform/
RUN apt-get update && \
mkdir -p /usr/share/man/man1/ /usr/share/man/man3/ /usr/share/man/man7/ && \
apt-get install -y --no-install-recommends \
libpq-dev \
build-essential \
gdal-bin \
postgresql-client \
git \
gettext \
mime-support \
nodejs \
npm && \
pip install --no-cache-dir -r requirements.txt -r requirements-prod.txt && \
apt-get remove -y build-essential libpq-dev && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives && \
npm install -g yarn
COPY docker-entrypoint.sh /usr/local/bin
ENTRYPOINT ["docker-entrypoint.sh"]
# ==============================
FROM base AS development
# ==============================
COPY requirements-dev.txt /city-infrastructure-platform/
RUN pip install --no-cache-dir -r requirements-dev.txt
ENV DEBUG=1
ENV APPLY_MIGRATIONS=1
ENV COLLECT_STATIC=1
ENV DEV_SERVER=1
COPY . /city-infrastructure-platform
RUN chown -R appuser:appuser /city-infrastructure-platform
USER appuser
EXPOSE 8000
# ===================================
FROM base AS build
# ===================================
COPY map-view/ /map-view/
RUN cd /map-view && yarn install && yarn build
# ==============================
FROM base AS production
# ==============================
ENV APPLY_MIGRATIONS=1
ENV COLLECT_STATIC=1
COPY . /city-infrastructure-platform
COPY --from=build /map-view/build/ /city-infrastructure-platform/map-view/build/
RUN chown -R appuser:appuser /city-infrastructure-platform
USER appuser
EXPOSE 8000