chore: fix container build and minimize container size (#380)

This commit is contained in:
ハン / Han authored and GitHub committed 2022-07-01 00:09:36 +08:00
1 parent 4d6d9b9d2f
commit 0c36f39514
3 files changed
+25 -8

No files matched your search

+15 -4
View File
@@ -1,7 +1,18 @@
FROM node:16-alpine
FROM node:16-alpine as build-stage
WORKDIR /app
RUN corepack enable
WORKDIR /root/app
COPY .npmrc package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile
COPY . .
RUN pnpm i --prod
RUN pnpm build
CMD pnpm preview --host
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]