This commit is contained in:
22
web/Dockerfile
Normal file
22
web/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
# 打包前端
|
||||
FROM node:18-alpine as build-stage
|
||||
|
||||
WORKDIR front
|
||||
COPY . .
|
||||
WORKDIR web
|
||||
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@8.6.10 --activate
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN pnpm install
|
||||
RUN pnpm run build
|
||||
|
||||
# 前端集成打包
|
||||
FROM nginx:alpine
|
||||
WORKDIR /data
|
||||
# 替换掉Nginx默认配置
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build-stage /front/docker/web.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build-stage /front/dist/ ./
|
||||
# 复制编译后的文件到容器内
|
||||
RUN /bin/sh -c 'echo init ok'
|
Reference in New Issue
Block a user