修复工作
This commit is contained in:
@@ -22,8 +22,8 @@ RUN npm run build:prod
|
||||
# 运行阶段
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
# 安装curl用于健康检查
|
||||
RUN apk add --no-cache curl
|
||||
# 安装curl和envsubst用于健康检查和环境变量替换
|
||||
RUN apk add --no-cache curl gettext
|
||||
|
||||
# 删除默认nginx配置
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
@@ -37,9 +37,5 @@ COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD curl -f http://localhost:80 || exit 1
|
||||
|
||||
# 启动Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# 使用envsubst替换环境变量,然后启动Nginx
|
||||
CMD sh -c "envsubst '\$NGINX_PORT' < /etc/nginx/conf.d/default.conf > /tmp/nginx.conf && mv /tmp/nginx.conf /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
|
||||
Reference in New Issue
Block a user