2023-03-24 01:54:51 +08:00
|
|
|
# build stage
|
2023-03-31 07:10:00 +08:00
|
|
|
FROM node:lts-alpine AS build-stage
|
2023-10-31 01:11:16 +08:00
|
|
|
# Set environment variables for non-interactive npm installs
|
|
|
|
ENV NPM_CONFIG_LOGLEVEL warn
|
|
|
|
ENV CI true
|
2023-03-24 01:54:51 +08:00
|
|
|
WORKDIR /app
|
2023-10-31 01:11:16 +08:00
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
RUN npm install -g pnpm && pnpm i --frozen-lockfile
|
2023-03-24 01:54:51 +08:00
|
|
|
COPY . .
|
|
|
|
RUN pnpm build
|
|
|
|
|
|
|
|
# production stage
|
2023-11-02 16:10:13 +08:00
|
|
|
FROM nginx:stable-alpine AS production-stage
|
2023-03-24 01:54:51 +08:00
|
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
2023-03-29 06:11:29 +08:00
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
2023-03-24 01:54:51 +08:00
|
|
|
EXPOSE 80
|
2023-11-02 16:10:13 +08:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|