2024-06-04 20:04:56 +08:00
|
|
|
FROM node:20-slim AS front
|
2024-05-12 15:53:54 +08:00
|
|
|
COPY . /build
|
2024-05-12 16:18:39 +08:00
|
|
|
WORKDIR /build/
|
2024-06-04 20:04:56 +08:00
|
|
|
RUN npm config set registry http://registry.npmmirror.com && npm install -g pnpm
|
|
|
|
|
|
|
|
RUN pnpm install && pnpm run build
|
2024-05-12 15:53:54 +08:00
|
|
|
|
|
|
|
FROM nginx:alpine
|
2024-05-12 20:45:57 +08:00
|
|
|
COPY --from=front /build/dist /usr/share/dist
|
2024-05-29 16:18:06 +08:00
|
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
2024-05-12 15:53:54 +08:00
|
|
|
|
|
|
|
# 将自定义配置文件nginx.conf复制到容器内/etc/nginx/conf.d/目录
|
2024-05-29 16:18:06 +08:00
|
|
|
ADD ./nginx.conf /etc/nginx/conf.d/
|
2024-05-12 15:53:54 +08:00
|
|
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|