# 简化的Dockerfile - 使用本地构建产物 FROM nginx:alpine # 安装curl用于健康检查 RUN apk add --no-cache curl # 复制自定义nginx配置 COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf # 复制本地构建的静态文件 COPY dist/ /usr/share/nginx/html # 设置正确的权限 RUN chown -R nginx:nginx /usr/share/nginx/html && \ chown -R nginx:nginx /var/cache/nginx && \ chown -R nginx:nginx /var/log/nginx && \ chown -R nginx:nginx /etc/nginx/conf.d # 创建nginx运行时需要的目录 RUN touch /var/run/nginx.pid && \ chown -R nginx:nginx /var/run/nginx.pid # 切换到非root用户 USER nginx # 暴露端口 EXPOSE 8080 # 健康检查 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/ || exit 1 # 启动nginx CMD ["nginx", "-g", "daemon off;"] # 添加标签信息 LABEL maintainer="walllee" \ org.opencontainers.image.title="Moodist" \ org.opencontainers.image.description="Ambient sounds for focus and calm - 多语言环境音应用" \ org.opencontainers.image.version="2.1.0" \ org.opencontainers.image.created="2025-11-16T06:53:40Z" \ org.opencontainers.image.revision="65958f8" \ org.opencontainers.image.source="https://github.com/wheesys/moodist" \ org.opencontainers.image.licenses="MIT"