-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
40 lines (32 loc) · 950 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
# -- compilation --
FROM node:20.17.0-alpine AS build
WORKDIR /app
# install dependencies
COPY package*.json ./
COPY backend/package*.json ./backend/
COPY frontend/package*.json ./frontend/
RUN npm ci
# copy in app code and build it
COPY . .
RUN npm run build
# -- execution --
FROM node:20.17.0-alpine
WORKDIR /app
# install PRODUCTION dependencies
COPY package*.json ./
COPY backend/package*.json ./backend/
COPY frontend/package*.json ./frontend/
RUN npm ci --omit=dev
RUN apk add --no-cache tini
# add the already compiled code and the default config
# (custom config must be set via volume)
COPY --from=build /app/dist ./dist
COPY --from=build /app/backend/dist ./backend/dist
COPY --from=build /app/frontend/dist ./frontend/dist
# config
USER node
ENV PORT=8080
EXPOSE 8080
# use tini as init process since Node.js isn't designed to be run as PID 1
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "--disable-proto=delete", "dist/main.js"]