-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (28 loc) · 957 Bytes
/
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
# syntax=docker/dockerfile:1
# NOTE:
# use this for Docker BuildKit when invoking Docker build on CLI:
# DOCKER_BUILDKIT=1 docker build .
# use the latest Node.js LTS, currently v16.
# but this is NOT for serious production just yet, it's still in development, so it will be fine.
FROM node:lts
# set NODE_ENV to use production:
ENV NODE_ENV=production
# set working directory inside container:
WORKDIR /usr/src/app
# add BOTH NPM package.json AND package-lock.json files to container:
COPY ["package*.json", "./"]
# NPM install packages:
RUN npm ci --production --only=production
# add project files to container:
COPY ["./dist*", "./public", "./views", "./"]
# if you want live file updates
#COPY . .
#VOLUME . .
# mock database initialization:
RUN npm run init-db
# run program in this project:
CMD [ "node", "dist-tsc/server.js" ]
# allow server port:
EXPOSE 8080
# At the end, set the user to use when running this image:
USER node