chore: docker

This commit is contained in:
胡鑫 2023-05-16 17:20:43 +08:00
parent 96d31c24bd
commit 43755e89da
1 changed files with 13 additions and 11 deletions

View File

@ -1,18 +1,20 @@
FROM node:16-alpine as build-stage
FROM node:18-bullseye
WORKDIR /app
RUN corepack enable
RUN mkdir -p /web
COPY .npmrc package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile
COPY . /web
WORKDIR /web
RUN npm config set registry https://registry.npm.taobao.org
RUN npm install -g pnpm
RUN pnpm install
COPY . .
RUN pnpm build
FROM nginx:stable-alpine as production-stage
ENV HOST 0.0.0.0
ENV PORT 3000
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]
CMD ["pnpm", "start"]