fix(web, P0): nginx entrypoint ln -sf 替换已有文件失败导致web容器无限重启,阻塞staging部署 #1855

Merged
auto-approve-bot merged 1 commits from fix/lipsync-worker-module-not-found into develop 2026-09-11 10:35:21 +08:00
+7 -2
View File
@@ -2,16 +2,21 @@
# Select nginx config based on APP_ENV (staging/production).
# Both configs are baked into the image at well-known paths.
# nginx reads config only at startup, so symlink before exec.
# 注意:基础镜像 /etc/nginx/conf.d/default.conf 是普通文件(非 symlink/目录),
# alpine busybox ln -sf 在 target 已存在且为普通文件时行为不稳定(会尝试在
# target 目录下建子链接),必须先 rm 再 ln 才能正确替换。
set -e
NGINX_CONF_DIR="/etc/nginx/conf.d"
case "${APP_ENV:-production}" in
staging)
ln -sf /etc/nginx/nginx-staging.conf "$NGINX_CONF_DIR/default.conf"
rm -f "$NGINX_CONF_DIR/default.conf"
ln -s /etc/nginx/nginx-staging.conf "$NGINX_CONF_DIR/default.conf"
;;
*)
ln -sf /etc/nginx/nginx-production.conf "$NGINX_CONF_DIR/default.conf"
rm -f "$NGINX_CONF_DIR/default.conf"
ln -s /etc/nginx/nginx-production.conf "$NGINX_CONF_DIR/default.conf"
;;
esac