-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (39 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
58 lines (39 loc) · 1.61 KB
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
57
58
# ################################################################
# ### Base image ###
# ################################################################
FROM node:22-alpine AS base
WORKDIR /opt
ENV NODE_ENV=production
RUN apk update; \
apk upgrade; \
npm i npm@next-11 -g; \
chown node:node -R /opt
#; \
# apk add --no-cache bash; \
# apk add --no-cache git; \
COPY --chown=node:node package*.json ./
COPY --chown=node:node assets ./assets
USER node
# ################################################################
# ### build image ###
# ################################################################
FROM base AS build
COPY --chown=node:node . .
RUN npm ci --include=dev --include=optional; \
npm cache clean --force
ENV PATH=/opt/node_modules/.bin:$PATH
RUN tsc -p ./tsconfig.node.json; \
resolve-tspaths --out "dist"; \
npm run spa-build
# ################################################################
# ### modules image ###
# ################################################################
FROM base AS modules
RUN npm install && npm cache clean --force
# ################################################################
# ### production image ###
# ################################################################
FROM base AS production
COPY --from=build --chown=node:node /opt/dist ./dist
COPY --from=modules --chown=node:node /opt/node_modules ./node_modules
CMD ["node", "dist/backend/main.js"]