mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 17:34:17 +00:00
49 lines
No EOL
1.4 KiB
Text
49 lines
No EOL
1.4 KiB
Text
# 简化的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;"]
|
|
|
|
# 定义构建参数
|
|
ARG VERSION=latest
|
|
ARG BUILD_DATE
|
|
ARG VCS_REF
|
|
|
|
# 添加标签信息
|
|
LABEL maintainer="walllee" \
|
|
org.opencontainers.image.title="Moodist" \
|
|
org.opencontainers.image.description="Ambient sounds for focus and calm - 多语言环境音应用" \
|
|
org.opencontainers.image.version="${VERSION}" \
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
org.opencontainers.image.revision="${VCS_REF}" \
|
|
org.opencontainers.image.source="https://github.com/wheesys/moodist" \
|
|
org.opencontainers.image.licenses="MIT" |