File tree Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Original file line number Diff line number Diff line change 1- FROM node:20
1+ # 如果需要用 cicd ,请设置环境变量:
2+ # variables:
3+ # DOCKER_BUILDKIT: 1
24
3- WORKDIR /gva_web/
4- COPY . .
5+ FROM node:20-slim AS base
6+ ENV PNPM_HOME="/pnpm"
7+ ENV PATH="$PNPM_HOME:$PATH"
8+ RUN corepack enable
9+ COPY . /app
10+ WORKDIR /app
511
6- RUN yarn && yarn build
712
8- FROM nginx:alpine
9- LABEL MAINTAINER="SliverHorn@sliver_horn@qq.com"
13+ FROM base AS prod-deps
14+ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod
15+
16+ FROM base AS build
17+ COPY --from=prod-deps /app/node_modules /app/node_modules
18+ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install && pnpm run build
1019
11- COPY .docker-compose/nginx/conf.d/my.conf /etc/nginx/conf.d/my.conf
12- COPY --from=0 /gva_web/dist /usr/share/nginx/html
13- RUN cat /etc/nginx/nginx.conf
14- RUN cat /etc/nginx/conf.d/my.conf
20+
21+ FROM nginx:alpine
22+ LABEL MAINTAINER="bypanghu@163.com"
23+ COPY --from=base /app/.docker-compose/nginx/conf.d/my.conf /etc/nginx/conf.d/my.conf
24+ COPY --from=build /app/dist /usr/share/nginx/html
1525RUN ls -al /usr/share/nginx/html
You can’t perform that action at this time.
0 commit comments