浏览代码

docker init

root 1 月之前
父节点
当前提交
df948de0ff
共有 4 个文件被更改,包括 57 次插入1 次删除
  1. 21 0
      Dockerfile
  2. 16 0
      docker-compose.yml
  3. 18 0
      nginx.conf
  4. 2 1
      src/config/index.js

+ 21 - 0
Dockerfile

@@ -0,0 +1,21 @@
+FROM node:20-slim as builder
+
+WORKDIR /app
+
+COPY package*.json ./
+
+RUN npm install
+
+COPY . .
+
+RUN npm run build
+
+FROM nginx:alpine
+
+COPY --from=builder /app/dist /usr/share/nginx/html
+
+COPY nginx.conf /etc/nginx/conf.d/default.conf
+
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]

+ 16 - 0
docker-compose.yml

@@ -0,0 +1,16 @@
+version: '3.8'
+
+services:
+  ai-agentic-pt:
+    build:
+      context: .
+      dockerfile: Dockerfile
+    container_name: ai-agentic-pt
+    ports:
+      - "8080:80"
+    restart: unless-stopped
+    healthcheck:
+      test: ["CMD", "wget", "-q", "--tries=1", "--spider", "http://localhost"]
+      interval: 30s
+      timeout: 10s
+      retries: 3

+ 18 - 0
nginx.conf

@@ -0,0 +1,18 @@
+server {
+    listen 80;
+    server_name localhost;
+    root /usr/share/nginx/html;
+    index index.html;
+
+    location / {
+        try_files $uri $uri/ /index.html;
+    }
+
+    location /api {
+        proxy_pass http://host.docker.internal:3000;
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $scheme;
+    }
+}

+ 2 - 1
src/config/index.js

@@ -1,6 +1,7 @@
 // 浏览器直接连后端 5001。Vite proxy 路径已停用以减少中间层开销。
 // CORS 走后端配置(CONSOLE_CORS_ALLOW_ORIGINS / WEB_API_CORS_ALLOW_ORIGINS)放行。
-export const API_BASE_URL = 'http://192.168.100.26:5001'
+// export const API_BASE_URL = 'http://192.168.100.26:5001'
+export const API_BASE_URL = 'http://8.130.184.42:11118'
 // export const API_BASE_URL = 'http://localhost:5001'
 export const API_PREFIX = `${API_BASE_URL}/console/api`
 export const PUBLIC_API_PREFIX = `${API_BASE_URL}/api`