-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
FROM node:20 | ||
# 如果需要用 cicd ,请设置环境变量: | ||
# variables: | ||
# DOCKER_BUILDKIT: 1 | ||
|
||
WORKDIR /gva_web/ | ||
COPY . . | ||
FROM node:20-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN yarn && yarn build | ||
|
||
FROM nginx:alpine | ||
LABEL MAINTAINER="SliverHorn@[email protected]" | ||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod | ||
|
||
FROM base AS build | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install && pnpm run build | ||
|
||
COPY .docker-compose/nginx/conf.d/my.conf /etc/nginx/conf.d/my.conf | ||
COPY --from=0 /gva_web/dist /usr/share/nginx/html | ||
RUN cat /etc/nginx/nginx.conf | ||
RUN cat /etc/nginx/conf.d/my.conf | ||
|
||
FROM nginx:alpine | ||
LABEL MAINTAINER="[email protected]" | ||
COPY --from=base /app/.docker-compose/nginx/conf.d/my.conf /etc/nginx/conf.d/my.conf | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
RUN ls -al /usr/share/nginx/html |