From a52db900e0d2585ca8b519486da599ae9b780fe9 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 5 Aug 2025 10:03:43 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84Nginx=E9=85=8D=E7=BD=AE=E5=92=8C=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ docker-entrypoint.sh | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17fae20..eda454c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM jmal/nginx-drawio:latest +RUN apk add --no-cache gettext + COPY nginx/nginx.conf.no_office.template /etc/nginx/nginx.conf.no_office.template COPY nginx/nginx.conf.template /etc/nginx/nginx.conf.template diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3b21c93..1fc862b 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,19 +1,15 @@ -#!/bin/bash +#!/bin/sh set -e -# 使用 getent 检查是否可以解析 office 容器的 IP +# ... 其余内容保持不变 ... if getent hosts office &> /dev/null; then - # 使用包含 office 的 Nginx 配置 cp /etc/nginx/nginx.conf.template /etc/nginx/nginx.conf else - # 使用不包含 office 的 Nginx 配置 cp /etc/nginx/nginx.conf.no_office.template /etc/nginx/nginx.conf fi envsubst '${API_URL} ${API_OFFICE_URL}' < /var/www/public/config.js.template > /var/www/public/config.js -# 循环检查,直到 jmalcloud 主机名可以被成功解析 -# 使用 getent hosts 是比 ping 更可靠的方式,因为它直接查询名称服务 while ! getent hosts jmalcloud > /dev/null 2>&1; do echo "jmalcloud is not yet resolvable, waiting 2 seconds..." sleep 2