Files
Universal-IoT-Java/cn-universal-web-ui/Dockerfile.ubuntu
T
2025-10-29 21:32:25 +08:00

32 lines
693 B
Docker

# 使用 Ubuntu 作为基础镜像
FROM ubuntu:22.04
# 安装 nginx 和必要工具
RUN apt-get update && apt-get install -y \
nginx \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*
# 复制前端构建文件
COPY dist/ /var/www/html/
# 复制 nginx 配置
COPY nginx.conf /etc/nginx/nginx.conf
# 创建必要的目录
RUN mkdir -p /var/log/nginx /var/cache/nginx
# 设置权限
RUN chown -R www-data:www-data /var/www/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;"]