| 12345678910111213141516 |
- #基于官方 NGINX 镜像部署(精简镜像)
- FROM nginx:alpine
- # 复制本地打包好的 dist 目录到 NGINX 静态资源目录
- COPY ./dist /usr/share/nginx/html
- # 替换 NGINX 默认配置(用我们自定义的 nginx.conf)
- COPY ./nginx.conf /etc/nginx/nginx.conf
- # 暴露容器端口(与 nginx.conf 中 listen 一致)
- #EXPOSE 80
- # 启动 NGINX(前台运行,避免容器启动后退出)
- CMD ["nginx", "-g", "daemon off;"]
|