mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
build(docker): 优化Docker构建流程并配置Nginx
- 合并RUN指令以减少镜像层数 - 移除不必要的cd和mkdir命令 - 添加Nginx配置文件复制步骤 - 清理HTML目录内容 - 暴露端口80用于Web服务
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -1,23 +1,20 @@
|
||||
FROM node:latest AS builder
|
||||
|
||||
RUN mkdir -p /workspace
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
RUN cd /workspace
|
||||
|
||||
RUN git clone https://github.com/setube/ogame-vue-ts.git
|
||||
|
||||
RUN mv ./ogame-vue-ts/* . ; rm -rf ./ogame-vue-ts/
|
||||
|
||||
RUN npm install -g pnpm ; pnpm install; pnpm build
|
||||
RUN npm install -g pnpm ; pnpm install;
|
||||
RUN pnpm build
|
||||
|
||||
# --- 第二阶段:Nginx ---
|
||||
FROM nginx:alpine
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY --from=builder /workspace/docs /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user