-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
56 lines (45 loc) · 1.53 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
FROM node:16-alpine as node
# Build stage
FROM node AS builder
LABEL author="Siyavash Habashi (ghashange) / Ronald Dehuysser (Bringme)"
ENV DOCKER_BUILD="true"
# the directory for your app within the docker image
# NOTE: if you need to change this, change the $CERT_WEBROOT_PATH env
WORKDIR /app
######################################################################################
# Add your own Dockerfile entries here
######################################################################################
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node
# Update the system
RUN apk --no-cache -U upgrade
# adds the packages certbot and tini
RUN apk add --no-cache certbot tini
ENTRYPOINT ["/sbin/tini", "--"]
# copy and chmod the shell script which will initiate the webroot
COPY letsencrypt_webroot.sh /
RUN chmod +x /letsencrypt_webroot.sh
WORKDIR /usr/src/server
# Copy package.json and package-lock.json
COPY package*.json ./
# Install only production dependencies
RUN npm i --only=production
# Copy transpiled js from builder stage into the final image
COPY --from=builder /app/dist ./dist
# Copy src/server into final image
COPY src/server ./src/server
# port 80 is mandatory for webroot challenge
# port 443 is mandatory for https
# port 3000 default port for UI and server in development mode
EXPOSE 80
EXPOSE 443
EXPOSE 3000
# Set all environment variables
ENV DOCKER_BUILD="false"
ENV NODE_ENV=production
ENV API_KEY=sendgrid-api-key
# the command which starts your express server.
CMD ["node", "./src/server/Server.js"]