docker變數設定

This commit is contained in:
koko 2025-06-11 18:12:07 +08:00
parent f88bd7fc4a
commit eaaaf3ad9d
32 changed files with 35 additions and 47 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -33,4 +33,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html
# 暴露 Nginx 預設的 80 端口
EXPOSE 80
# Nginx 已經預設啟動,所以不需要 CMD 指令
# Nginx 已經預設啟動,所以不需要 CMD 指令
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

3
docker-entrypoint.sh Normal file
View File

@ -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 "$@"

View File

@ -17,6 +17,7 @@
type="text/javascript"
src="/module/js/com/tridium/js/ext/require/require.min.js?"
></script> -->
<script src="/env.js"></script>
</head>
<body>
<div id="app"></div>

View File

@ -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`;

View File

@ -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`;

View File

@ -1,7 +1,7 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const forgeDom = ref(null);
let viewer = null;

View File

@ -164,7 +164,7 @@ const initForge = async () => {
// });
// });
// });
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const viewer = await initViewer(forgeDom.value)
const filePath = `${FILE_BASEURL}/upload/forge/0.svf`;
await loadModel(viewer, filePath)

View File

@ -93,7 +93,7 @@ const createSprites = async (dataVizExtn) => {
const DataVizCore = Autodesk.DataVisualization.Core;
const viewableType = DataVizCore.ViewableType.SPRITE;
let spriteColor = new THREE.Color(0xffffff);
const BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const BASEURL = window.env?.VITE_FILE_API_BASEURL;
const spriteIconUrl = `${BASEURL}/dist/hotspot.svg`;
const style = new DataVizCore.ViewableStyle(
viewableType,

View File

@ -1,4 +1,4 @@
const BASEURL = import.meta.env.VITE_API_BASEURL;
const BASEURL = window.env?.VITE_API_BASEURL;
export const POST_LOGIN = `${BASEURL}/api/Login/`;
export const GET_AUTHPAGE_API = `${BASEURL}/api/GetUsrFroList`;
export const GET_SUBAUTHPAGE_API = `${BASEURL}/api/Device/GetMainSub`;

View File

@ -1,4 +1,4 @@
const BASEURL = import.meta.env.VITE_API_BASEURL;
const BASEURL = window.env?.VITE_API_BASEURL;
export const GET_FORGETOKEN_API = `${BASEURL}/api/forge/oauth/token`;
export const GET_FORGEURN_API = `${BASEURL}/api/Device/GetBuild`;

View File

@ -72,7 +72,7 @@ export default function useForgeSprite() {
const DataVizCore = Autodesk.DataVisualization.Core;
const viewableType = DataVizCore.ViewableType.SPRITE;
let spriteColor = new THREE.Color(0xffffff);
const BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const BASEURL = window.env?.VITE_FILE_API_BASEURL;
const spriteIconUrl = `${BASEURL}/dist/hotspot.svg`;
const style = new DataVizCore.ViewableStyle(
viewableType,

View File

@ -1,4 +1,4 @@
const BASEURL = import.meta.env.VITE_API_BASEURL;
const BASEURL = window.env?.VITE_API_BASEURL;
export default function downloadExcel(res) {
let disposition = res.headers.get("Content-Disposition");

View File

@ -1,6 +1,6 @@
import useGetCookie from "@/hooks/useGetCookie";
import axios from "axios";
const BASEURL = import.meta.env.VITE_API_BASEURL;
const BASEURL = window.env?.VITE_API_BASEURL;
const instance = axios.create({
baseURL: BASEURL,

View File

@ -10,7 +10,7 @@ import { useI18n } from "vue-i18n";
const { t } = useI18n();
const { openToast, cancelToastOpen } = inject("app_toast");
const { companyOptions, departmentList, floors } = inject("asset_modal_options");
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { searchParams, changeParams } = useSearchParam();
const totalCoordinates = ref({});

View File

@ -10,7 +10,7 @@ import useUserInfoStore from "@/stores/useUserInfoStore";
import dayjs from "dayjs";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { searchParams, changeParams } = useSearchParam();
const { updateLeftFields, formErrorMsg, formState } = inject(
"asset_table_modal_form"

View File

@ -4,7 +4,7 @@ import { ref, computed, inject, watch, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import Menu from "@/components/customUI/Menu.vue";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { formState } = inject("asset_table_modal_form");
const columns = computed(() => [
{

View File

@ -7,7 +7,7 @@ import dayjs from "dayjs";
const { t } = useI18n();
const { openToast, cancelToastOpen } = inject("app_toast");
const { formState } = inject("asset_table_modal_form");
const BASEURL = import.meta.env.VITE_MQTT_BASEURL;
const BASEURL = window.env?.VITE_MQTT_BASEURL;
// MQTT
const mqttClient = ref(null); // MQTT
const receivedMessages = ref([]); //

View File

@ -7,7 +7,7 @@ import { twMerge } from "tailwind-merge";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { totalCoordinates } = inject("asset_table_data");
const { floors } = inject("asset_modal_options");
const { updateRightFields, formErrorMsg, formState } = inject(

View File

@ -7,7 +7,7 @@ import "yup-phone-lite";
import useFormErrorMessage from "@/hooks/useFormErrorMessage";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const props = defineProps({
editRecord: Object,

View File

@ -5,7 +5,7 @@ import { twMerge } from "tailwind-merge";
import useBuildingStore from "@/stores/useBuildingStore";
const store = useBuildingStore();
const router = useRouter();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const navigateToSubSystem = (mainSystemId, subSystemId) => {
router.push({
name: "sub_system",

View File

@ -10,7 +10,7 @@ import {
} from "@/apis/graph";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const BASEURL = window.env?.VITE_FILE_API_BASEURL;
const props = defineProps({
updateEditRecord: Function,

View File

@ -8,7 +8,7 @@ import { useI18n } from "vue-i18n";
const { t } = useI18n();
const { openToast, cancelToastOpen } = inject("app_toast");
const { sidebar_data } = inject("current_dir");
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const columns = computed(() => [
{

View File

@ -8,7 +8,7 @@ import useSearchParam from "@/hooks/useSearchParam";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const { openToast, cancelToastOpen } = inject("app_toast");
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { searchParams } = useSearchParam();
const { dataSource, openModal, updateEditRecord, search, tableLoading } =

View File

@ -12,7 +12,7 @@ import Select from "@/components/customUI/Select.vue";
import SearchSelect from "@/components/customUI/SearchSelect.vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const props = defineProps({
editRecord: Object,

View File

@ -7,7 +7,7 @@ import { useI18n } from "vue-i18n";
import useBuildingStore from "@/stores/useBuildingStore";
const storeBuild = useBuildingStore();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { t } = useI18n();
const { openToast, cancelToastOpen } = inject("app_toast");

View File

@ -11,7 +11,7 @@ const { currentFloor, subscribeData } = inject("system_deviceList");
const { getCurrentInfoModalData, selected_dbid } = inject(
"system_selectedDevice"
);
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const asset_floor_chart = ref(null);
const sameOption = {

View File

@ -8,7 +8,7 @@ const { getCurrentInfoModalData, selected_dbid } = inject(
const { subscribeData } = inject("system_deviceList");
const { showData } = useSystemShowData();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const fitToView = (forge_dbid, spriteDbId) => {
selected_dbid.value = [forge_dbid, spriteDbId];

View File

@ -2,7 +2,7 @@
import { computed, inject, watch, ref } from "vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
const { selectedDeviceCog } = inject("system_selectedDevice");
const imgData = ref([]);

View File

@ -13,15 +13,6 @@ export default defineConfig({
outDir: "./dist",
emptyOutDir: true,
},
server: {
proxy: {
'/upload': {
target: "https://ibms-cvilux.production.mjmtech.com.tw",
changeOrigin: true,
secure: false,
},
},
},
plugins: [
vue(),
Components({
@ -47,4 +38,4 @@ export default defineConfig({
"@ASSET": fileURLToPath(new URL("./src/assets", import.meta.url)),
},
},
});
});