forked from koroonakaart/koroonakaart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (30 loc) · 1.08 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
############################
# STEP 1 fetch data from TEHIK and aggregate it to into data.json
############################
# https://hub.docker.com/_/python
FROM python:3.7-buster AS fetch_data
WORKDIR /app
COPY . .
RUN cd TEHIK_Open_Data_Loading_Scripts \
python -m pip install --upgrade pip \
python main.py
#########################
# STEP 2 build frontend
#########################
# https://hub.docker.com/_/node
FROM node:erbium-buster AS build_frontend
WORKDIR /app
COPY . .
COPY --from=fetch_data /app/data/data.json /app/data/data.json
RUN cd koroonakaart \
npm install --silent \
npm run build
#########################
# STEP 3 build the image (Nginx serving frontend)
#########################
# https://hub.docker.com/_/nginx
FROM nginx:1.19.2-alpine
# Nginx needs to redirect requests like '/et' etc to index.html
RUN sed -i '/index.html index.htm;/ i try_files $uri /index.html;' /etc/nginx/conf.d/default.conf
COPY --from=build_frontend /app/koroonakaart/dist /usr/share/nginx/html
COPY --from=fetch_data /app/koroonakaart/src/data.json /usr/share/nginx/html/data.json