Files
huihuiSquare/digital-avatar-app/Dockerfile
2026-07-24 14:04:21 +08:00

23 lines
803 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 构建阶段:安装依赖并打包 H5
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
# 跳过 vue-tsc 类型检查直接打包(与本机已知 vue-tsc + Node 版本兼容问题无关,保证可构建)
RUN npx vite build
# 运行阶段nginx 托管静态资源并反向代理 /api 到后端
# 锁定 1.28-alpine测试服务器 Docker 的 seccomp 拦截 pwrite 系统调用,
# 新版 nginx(>=1.31) 用 pwrite 写 pid 文件会被拦导致致命退出1.28 用 write() 可正常启动。
FROM nginx:1.28-alpine
COPY --from=build /app/dist /usr/share/nginx/html
# 覆盖 nginx 默认主配置(含唯一可写的 pid /tmp/nginx.pid规避受限容器内 /run 不可写导致反复重启)
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80