diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..209bebc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.git +.gitignore +Dockerfile +docker-compose.yml +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..46b5725 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# 使用 Node.js 作為基礎映像 +FROM node:18-alpine AS builder + +# 設定工作目錄 +WORKDIR /app + +# 複製 package.json 和 package-lock.json (或 yarn.lock) 到工作目錄 +COPY package*.json ./ + +# 安裝依賴 +RUN npm install --legacy-peer-deps + +# 複製所有檔案到工作目錄 +COPY . . + +# 清理緩存並重新構建 +RUN npm cache clean --force +RUN rm -rf node_modules +RUN npm install --legacy-peer-deps + +# 構建前端應用 (如果需要) +RUN npm run build --omit=dev + +# 使用一個更小的映像來提供靜態文件 (例如 Nginx) +FROM nginx:alpine + +# 將構建好的靜態檔案複製到 Nginx 的預設目錄 +COPY --from=builder /app/dist /usr/share/nginx/html + +# (可選) 複製自定義 Nginx 設定檔 +# COPY nginx.conf /etc/nginx/conf.d/default.conf + +# 暴露 Nginx 預設的 80 端口 +EXPOSE 80 + +# Nginx 已經預設啟動,所以不需要 CMD 指令 \ No newline at end of file diff --git a/src/apis/account/index.js b/src/apis/account/index.js index 210b375..f2f8454 100644 --- a/src/apis/account/index.js +++ b/src/apis/account/index.js @@ -10,7 +10,7 @@ import { DELETE_ACCOUNT_USER_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getAccountUserList = async (search_condition = {}) => { const res = await instance.post(GET_ACCOUNT_USERLIST_API, search_condition); diff --git a/src/apis/alert/index.js b/src/apis/alert/index.js index 0d54384..865b6c3 100644 --- a/src/apis/alert/index.js +++ b/src/apis/alert/index.js @@ -22,7 +22,7 @@ import { POST_ALERT_MQTT_REFRESH } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getAlertFormId = async (uuid) => { const res = await instance.post(GET_ALERT_FORMID_API, uuid); diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index e124482..adb52d1 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -28,7 +28,7 @@ import { POST_ASSET_ELEC_SETTING_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; import { object } from "yup"; export const getAssetMainList = async (building_guid) => { diff --git a/src/apis/building/index.js b/src/apis/building/index.js index 0c3579e..e726f1e 100644 --- a/src/apis/building/index.js +++ b/src/apis/building/index.js @@ -7,7 +7,7 @@ import { GET_ALL_DEVICE_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getBuildings = async () => { const res = await instance.post(GET_BUILDING_API); diff --git a/src/apis/dashboard/index.js b/src/apis/dashboard/index.js index e238c40..4ed95e8 100644 --- a/src/apis/dashboard/index.js +++ b/src/apis/dashboard/index.js @@ -13,7 +13,7 @@ import { GET_DASHBOARD_ALARMOPERATION_INFO_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getDashboardInit = async (page_type = "SR") => { const res = await instance.post(GET_DASHBOARD_INIT_API, { diff --git a/src/apis/energy/index.js b/src/apis/energy/index.js index 1e7057c..a0c877a 100644 --- a/src/apis/energy/index.js +++ b/src/apis/energy/index.js @@ -15,7 +15,7 @@ import { POST_TIME_ELEC_API, } from "./api"; import instance, { fileInstance } from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; import downloadExcel from "@/util/downloadExcel"; export const getRealTimeDist = async ({ diff --git a/src/apis/forge/index.js b/src/apis/forge/index.js index d13d4bb..1100b39 100644 --- a/src/apis/forge/index.js +++ b/src/apis/forge/index.js @@ -1,6 +1,6 @@ import instance from "@/util/request"; import { GET_FORGETOKEN_API, GET_FORGEURN_API } from "./api"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getUrn = async () => { const res = await instance.post(GET_FORGEURN_API); diff --git a/src/apis/login/index.js b/src/apis/login/index.js index 2bb6498..f2bd9e6 100644 --- a/src/apis/login/index.js +++ b/src/apis/login/index.js @@ -1,6 +1,6 @@ import { POST_LOGIN } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export async function Login({ account, password }) { const res = await instance.post(POST_LOGIN, { diff --git a/src/apis/operation/index.js b/src/apis/operation/index.js index c7c9d1b..9a42892 100644 --- a/src/apis/operation/index.js +++ b/src/apis/operation/index.js @@ -12,7 +12,7 @@ import { DELETE_OPERATION_COMPANY_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; import dayjs from "dayjs"; export const getOperationRecord = async ({ diff --git a/src/apis/productSetting/index.js b/src/apis/productSetting/index.js index 1ed4d46..d811279 100644 --- a/src/apis/productSetting/index.js +++ b/src/apis/productSetting/index.js @@ -1,5 +1,5 @@ import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; import { POST_SETTING_POINT_API, GET_SETTING_TYPE_API, diff --git a/src/apis/system/index.js b/src/apis/system/index.js index 900ac6d..787689d 100644 --- a/src/apis/system/index.js +++ b/src/apis/system/index.js @@ -4,7 +4,7 @@ import { GET_SYSTEM_REALTIME_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apihandler from "@/util/apiHandler"; export const getSystemFloors = async (building_tag, sub_system_tag) => { const res = await instance.post(GET_SYSTEM_FLOOR_LIST_API, { diff --git a/src/main.js b/src/main.js index 1c847f2..9915b17 100644 --- a/src/main.js +++ b/src/main.js @@ -15,7 +15,7 @@ import App from "./App.vue"; import router from "./router"; import "virtual:svg-icons-register"; // 引入项目中的全部全局组件 -import SvgIcon from "@/components/svgIcon.vue"; +import SvgIcon from "@/components/SvgIcon.vue"; import library from "./fontawsomeIconRegister"; import "flag-icons/css/flag-icons.min.css"; diff --git a/vite.config.js b/vite.config.js index 0d64448..4aff6ff 100644 --- a/vite.config.js +++ b/vite.config.js @@ -10,7 +10,7 @@ import path from "path"; export default defineConfig({ base: process.env.NODE_ENV === "production" ? "./" : "/", build: { - outDir: process.env.NODE_ENV === "production" ? "../dist" : "./dist", + outDir: "./dist", emptyOutDir: true, }, server: {