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