From eaaaf3ad9da87ea9f46e9da52c87cb8a633fb028 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Wed, 11 Jun 2025 18:12:07 +0800 Subject: [PATCH] =?UTF-8?q?docker=E8=AE=8A=E6=95=B8=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 ---- .env.production | 4 ---- .env.staging | 3 --- Dockerfile | 6 +++++- docker-entrypoint.sh | 3 +++ index.html | 1 + src/apis/graph/api.js | 2 +- src/apis/history/api.js | 2 +- src/components/forge/Forge.vue | 2 +- src/components/forge/ForgeForSystem.vue | 2 +- src/components/forge/index.vue | 2 +- src/constant/api_app.js | 2 +- src/constant/api_forge.js | 2 +- src/hooks/forge/useForgeSprite.js | 2 +- src/util/downloadExcel.js | 2 +- src/util/request.js | 2 +- src/views/AssetManagement/components/AssetTable.vue | 2 +- .../components/AssetTableModalLeftInfo.vue | 2 +- .../components/AssetTableModalLeftInfoGraph.vue | 2 +- .../components/AssetTableModalLeftInfoMQTT.vue | 2 +- .../components/AssetTableModalRightInfo.vue | 2 +- .../alert/components/AlertQuery/AlertTableModal.vue | 2 +- src/views/dashboard/components/DashboardSysCard.vue | 2 +- src/views/graphManagement/components/GraphModal.vue | 2 +- src/views/graphManagement/components/GraphTable.vue | 2 +- src/views/operation/components/OperationTable.vue | 2 +- .../operation/components/OperationTableModal.vue | 2 +- src/views/setting/components/Floors.vue | 2 +- src/views/system/SystemFloor.vue | 2 +- src/views/system/components/SystemCard.vue | 2 +- src/views/system/components/SystemInfoModalImage.vue | 2 +- vite.config.js | 11 +---------- 32 files changed, 35 insertions(+), 47 deletions(-) delete mode 100644 .env.development delete mode 100644 .env.production delete mode 100644 .env.staging create mode 100644 docker-entrypoint.sh diff --git a/.env.development b/.env.development deleted file mode 100644 index 6da8916..0000000 --- a/.env.development +++ /dev/null @@ -1,4 +0,0 @@ -VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" -VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" -VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.production b/.env.production deleted file mode 100644 index 41e8aa1..0000000 --- a/.env.production +++ /dev/null @@ -1,4 +0,0 @@ -VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" -VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" -# VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.staging b/.env.staging deleted file mode 100644 index 3a51cfe..0000000 --- a/.env.staging +++ /dev/null @@ -1,3 +0,0 @@ -VITE_API_BASEURL = "http://220.132.206.5:8008" -VITE_FILE_API_BASEURL = "http://220.132.206.5:8085/file" -VITE_FORGE_BASEURL = "http://localhost:5173" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 46b5725..6ffd4b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html # 暴露 Nginx 預設的 80 端口 EXPOSE 80 -# Nginx 已經預設啟動,所以不需要 CMD 指令 \ No newline at end of file +# Nginx 已經預設啟動,所以不需要 CMD 指令 +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..2bbda52 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,3 @@ +#!/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}' };" > /usr/share/nginx/html/env.js +exec "$@" \ No newline at end of file diff --git a/index.html b/index.html index 0f7fd58..81a2361 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ type="text/javascript" src="/module/js/com/tridium/js/ext/require/require.min.js?" > --> +
diff --git a/src/apis/graph/api.js b/src/apis/graph/api.js index 427ae7c..73f513b 100644 --- a/src/apis/graph/api.js +++ b/src/apis/graph/api.js @@ -1,5 +1,5 @@ // graph -const BASEURL = import.meta.env.VITE_API_BASEURL; +const BASEURL = window.env?.VITE_API_BASEURL; export const GET_GRAPH_SIDEBAR_API = `/GraphManage/GraphManageTreeList`; export const UPDATE_GRAPH_SIDEBAR_API = `/GraphManage/EditGraphManageTree`; diff --git a/src/apis/history/api.js b/src/apis/history/api.js index 64de717..c0fd361 100644 --- a/src/apis/history/api.js +++ b/src/apis/history/api.js @@ -1,5 +1,5 @@ // history -const BASEURL = import.meta.env.VITE_API_BASEURL; +const BASEURL = window.env?.VITE_API_BASEURL; export const GET_HISTORY_SIDEBAR_API = `/api/History/GetDeviceInfo`; export const GET_HISTORY_POINT_API = `/api/History/GetAllDevPoi`; export const GET_HISTORY_DATA_API = `/api/History/GetHistoryData`; diff --git a/src/components/forge/Forge.vue b/src/components/forge/Forge.vue index e55b62d..49d4d58 100644 --- a/src/components/forge/Forge.vue +++ b/src/components/forge/Forge.vue @@ -1,7 +1,7 @@