docker設定

This commit is contained in:
koko 2025-05-13 15:34:07 +08:00
parent 0772269c33
commit 36f5ca4fd0
15 changed files with 55 additions and 13 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
.git
.gitignore
Dockerfile
docker-compose.yml
README.md

36
Dockerfile Normal file
View File

@ -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 指令

View File

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

View File

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

View File

@ -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) => {

View File

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

View File

@ -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, {

View File

@ -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 ({

View File

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

View File

@ -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, {

View File

@ -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 ({

View File

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

View File

@ -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, {

View File

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

View File

@ -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: {