-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
48 lines (36 loc) · 1.3 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
################################
# STEP 1 build executable binary
################################
FROM docker.io/node:14-alpine as build-stage
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apk update \
&& apk add --no-cache git ca-certificates tzdata \
&& update-ca-certificates 2>/dev/null || true
# make the 'app' folder the current working directory
WORKDIR /app
# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json yarn*.lock ./
# install project dependencies
RUN yarn install
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
# build the app
RUN yarn build
############################
# STEP 2 build a small image
############################
FROM docker.io/nginx:stable-alpine
LABEL maintainer="https://github.com/saferwall"
LABEL version="1.0.0"
LABEL description="Saferwall UI Dashboard"
# copy the artifacts from the build stage.
COPY --from=build-stage /app/dist /usr/share/nginx/html
# copy out nginx conf.
COPY nginx.conf /etc/nginx/conf.d/default.conf
# the entrypoint script will replace environment variables in JS files and
# will kick in nginx
COPY entrypoint.sh /
RUN chmod +x entrypoint.sh
CMD ["/entrypoint.sh"]