diff --git a/Dockerfile b/Dockerfile index d42c142..d99ad28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html # 暴露 Nginx 預設的 80 端口 EXPOSE 80 -# 2025-08-20 -LABEL changelog="2025-08-20: 動態設定網頁標題與 favicon與logo與預設build_img,標題由 VITE_APP_TITLE 環境變數控制,favicon、logo、build_img.jpg 由 VITE_FILE_API_BASEURL 動態插入,docker-entrypoint.sh 寫入 env.js 供前端讀取。" +# 2025-08-21 +LABEL changelog="2025-08-21: index.html 的 及 favicon 由 docker-entrypoint.sh 啟動時根據環境變數直接替換,社群爬蟲可正確抓取,env.js 仍供前端 JS 讀取其他動態參數。" # Nginx 已經預設啟動,所以不需要 CMD 指令 COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index aef6486..d85cfb1 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,3 +1,5 @@ #!/bin/sh echo "window.env = { VITE_API_BASEURL: '${VITE_API_BASEURL}', VITE_FILE_API_BASEURL: '${VITE_FILE_API_BASEURL}', VITE_MQTT_BASEURL: '${VITE_MQTT_BASEURL}', VITE_APP_TITLE: '${VITE_APP_TITLE}' };" > /usr/share/nginx/html/env.js +sed -i "s|<title>.*|${VITE_APP_TITLE}|g" /usr/share/nginx/html/index.html +sed -i "s| Cvilux EMS - +