mirror of
https://gitee.com/NexIoT/Universal-IoT-Java.git
synced 2026-10-31 00:41:27 +08:00
27 lines
586 B
Docker
27 lines
586 B
Docker
FROM nginx:alpine
|
|
|
|
# 安装健康检查所需工具
|
|
RUN apk add --no-cache curl
|
|
|
|
# 复制前端构建文件
|
|
COPY dist/ /usr/share/nginx/html/
|
|
|
|
# 复制 nginx 配置
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# 创建必要的目录
|
|
RUN mkdir -p /var/log/nginx /var/cache/nginx
|
|
|
|
# 设置权限
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html /var/log/nginx /var/cache/nginx
|
|
|
|
# 暴露端口
|
|
EXPOSE 80
|
|
|
|
# 健康检查
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:80/health || exit 1
|
|
|
|
# 启动 nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|