File tree Expand file tree Collapse file tree 1 file changed +42
-14
lines changed Expand file tree Collapse file tree 1 file changed +42
-14
lines changed Original file line number Diff line number Diff line change 11# build front-end
2- FROM node:lts-alpine AS builder
2+ FROM node:lts-alpine AS frontend
3+
4+ RUN npm install pnpm -g
35
4- COPY ./ /app
56WORKDIR /app
67
7- RUN apk add --no-cache git \
8- && npm install pnpm -g \
9- && pnpm install \
10- && pnpm run build \
11- && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*
8+ COPY ./package.json /app
9+
10+ COPY ./pnpm-lock.yaml /app
11+
12+ RUN pnpm install
13+
14+ COPY . /app
15+
16+ RUN pnpm run build
17+
18+ # build backend
19+ FROM node:lts-alpine as backend
20+
21+ RUN npm install pnpm -g
22+
23+ WORKDIR /app
24+
25+ COPY /service/package.json /app
26+
27+ COPY /service/pnpm-lock.yaml /app
28+
29+ RUN pnpm install
30+
31+ COPY /service /app
32+
33+ RUN pnpm build
1234
1335# service
1436FROM node:lts-alpine
1537
16- COPY /service /app
17- COPY --from=builder /app/dist /app/public
38+ RUN npm install pnpm -g
1839
1940WORKDIR /app
20- RUN apk add --no-cache git \
21- && npm install pnpm -g \
22- && pnpm install --only=production \
23- && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*
2441
42+ COPY /service/package.json /app
43+
44+ COPY /service/pnpm-lock.yaml /app
45+
46+ RUN pnpm install --production && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*
47+
48+ COPY /service /app
49+
50+ COPY --from=frontend /app/dist /app/public
51+
52+ COPY --from=backend /app/build /app/build
2553
2654EXPOSE 3002
2755
28- CMD ["pnpm" , "run" , "start " ]
56+ CMD ["pnpm" , "run" , "prod " ]
You can’t perform that action at this time.
0 commit comments