-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (29 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
46 lines (29 loc) · 1.1 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
# ----------------------------------------------------------------------------------------
# Build image:
FROM node:22-alpine AS builder
WORKDIR /opt
COPY ./package.json ./package.json
COPY ./server ./server
COPY ./client/src ./client/src
COPY ./client/assets ./client/assets
COPY ./client/package.json ./client/package.json
COPY ./client/vite.config.js ./client/vite.config.js
RUN npm i
RUN npm run install:client
RUN npm run build:client
# ----------------------------------------------------------------------------------------
# Deploy image:
FROM node:22-alpine
WORKDIR /opt/
# COPY --from=builder /opt/node_modules /opt/node_modules
COPY --from=builder /opt/package.json /opt/package.json
RUN npm i --omit=dev
COPY --from=builder /opt/server /opt/server
COPY --from=builder /opt/client/dist /opt/client/dist
COPY --from=builder /opt/client/assets /opt/client/assets
COPY --from=builder /opt/client/package.json /opt/client/package.json
RUN npm i /opt/client --omit=dev
# COPY --from=builder /opt/client/node_modules /opt/client/node_modules
ENV PORT=8080
EXPOSE 8080
CMD ["node", "server/index.js"]