-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (58 loc) · 2.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
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
71
72
ARG MP_VERSION=v3.4.0
ARG ADDONS_TAG=dev-server-setup
ARG PORTAL_TAG=dev-server-setup
# TODO: readd this argument
#ARG PORTAL_NAME=simulation
# build stage
FROM node:20-alpine AS build
ARG MP_VERSION
ARG ADDONS_TAG
ARG PORTAL_TAG
# libs needed to build the masterportal
RUN apk update && apk add --no-cache --virtual .gyp \
make \
g++ \
pkgconfig \
pixman-dev \
cairo-dev \
pango-dev \
python3 \
git \
libc6-compat
# get the masterportal
RUN git clone https://bitbucket.org/geowerkstatt-hamburg/masterportal.git
WORKDIR /masterportal
RUN git checkout ${MP_VERSION}
RUN rm -f .gitignore && git add .
# get the addons config
RUN rm -rf addons && git add .
RUN git submodule add https://github.com/citysciencelab/scenario-explorer-addon.git addons
WORKDIR /masterportal/addons
RUN git checkout ${ADDONS_TAG}
RUN for file in $(ls -d */); do cd $file; if (test -f package.json); then npm i; fi; cd ..; done
# get the portal config
WORKDIR /masterportal
RUN rm -rf portal && git add . && mkdir portal
WORKDIR /masterportal/portal
RUN git submodule add -f https://github.com/citysciencelab/scenario-explorer-portalconfig.git simulation
WORKDIR /masterportal/portal/simulation
RUN git checkout ${PORTAL_TAG}
# install dependencies and build the masterportal
WORKDIR /masterportal
RUN npm ci && echo "" | npm run build
# webserver stage
FROM nginx:1.27.1-alpine-slim
ARG GIT_COMMIT
ARG APP_VERSION
LABEL org.opencontainers.image.authors="terrestris GmbH & Co. KG <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/citysciencelab/masterportal-scenario-explorer"
LABEL org.opencontainers.image.description="Scenario Explorer for the Urban Model Platform"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.revision=$GIT_COMMIT
LABEL org.opencontainers.image.version=$APP_VERSION
RUN echo "Current directory:" && pwd
RUN echo "$(pwd && ls -lah)"
COPY --from=build /masterportal/dist /usr/share/nginx/html/portal
RUN cp -r /usr/share/nginx/html/portal/mastercode/*/* /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]