-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
54 lines (34 loc) · 1.26 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
# STAGE 1: layered build of PolkADAPT submodule and Polkascan Explorer application.
FROM node:lts-alpine as builder
# Install the application dependencies.
WORKDIR /app
COPY package.json .
RUN npm i
# Copy the rest of the files and build the application.
COPY . .
ARG ENV_CONFIG=production
ENV ENV_CONFIG=$ENV_CONFIG
RUN npm exec ng build -- --configuration ${ENV_CONFIG}
# STAGE 2: Nginx setup to serve the application.
FROM nginx:stable-alpine
# Allow for various nginx proxy configuration.
ARG NGINX_CONF=nginx/calendar-ui.conf
ENV NGINX_CONF=$NGINX_CONF
# Remove default nginx configs.
RUN rm -rf /etc/nginx/conf.d/*
# Copy the nginx config.
COPY ${NGINX_CONF} /etc/nginx/conf.d/
# Remove default nginx website.
RUN rm -rf /usr/share/nginx/html/*
# Copy build artifacts from ‘builder’ stage to default nginx public folder.
COPY --from=builder /app/dist/calendar-ui /usr/share/nginx/html
# Copy config.json file for runtime environment variables.
ARG CONFIG_JSON=src/assets/config.json
ENV CONFIG_JSON=$CONFIG_JSON
COPY $CONFIG_JSON /usr/share/nginx/html/assets/config.json
# Copy logo directory
ARG LOGOS_DIR=src/assets/logos
ENV LOGOS_DIR=$LOGOS_DIR
COPY $LOGOS_DIR /usr/share/nginx/html/assets/logos
EXPOSE 80
CMD ["/bin/sh", "-c", "exec nginx -g 'daemon off;'"]