Update docker compose for frontend
This commit is contained in:
@@ -4,10 +4,10 @@ services:
|
|||||||
# 后端 API
|
# 后端 API
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ../api
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8100:8100"
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=sqlite:///./data/app.db
|
- DATABASE_URL=sqlite:///./data/app.db
|
||||||
- MINIO_ENDPOINT=minio:9000
|
- MINIO_ENDPOINT=minio:9000
|
||||||
@@ -15,20 +15,32 @@ services:
|
|||||||
- MINIO_SECRET_KEY=password123
|
- MINIO_SECRET_KEY=password123
|
||||||
- MINIO_BUCKET=ai-audio
|
- MINIO_BUCKET=ai-audio
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend:/app
|
- ../api:/app
|
||||||
- ./backend/data:/app/data
|
- ../api/data:/app/data
|
||||||
depends_on:
|
depends_on:
|
||||||
- minio
|
- minio
|
||||||
|
|
||||||
# 对话引擎 (py-active-call)
|
# 对话引擎 (py-active-call)
|
||||||
engine:
|
engine:
|
||||||
build:
|
build:
|
||||||
context: ../py-active-call
|
context: ../engine
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8001:8001"
|
- "8001:8001"
|
||||||
environment:
|
environment:
|
||||||
- BACKEND_URL=http://backend:8000
|
- BACKEND_URL=http://backend:8100
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
|
||||||
|
# 前端 (Vite + React)
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ../web
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
- VITE_API_BASE_URL=http://localhost:8100/api
|
||||||
|
ports:
|
||||||
|
- "6000:6000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
@@ -44,6 +56,3 @@ services:
|
|||||||
MINIO_ROOT_USER: admin
|
MINIO_ROOT_USER: admin
|
||||||
MINIO_ROOT_PASSWORD: password123
|
MINIO_ROOT_PASSWORD: password123
|
||||||
command: server /data --console-address ":9001"
|
command: server /data --console-address ":9001"
|
||||||
|
|
||||||
volumes:
|
|
||||||
minio-data:
|
|
||||||
|
|||||||
7
web/.dockerignore
Normal file
7
web/.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
*.md
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
24
web/Dockerfile
Normal file
24
web/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
ARG VITE_API_BASE_URL=http://localhost:8100/api
|
||||||
|
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Serve stage (no nginx – Node + serve on port 6000)
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
RUN npm install -g serve
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
|
EXPOSE 6000
|
||||||
|
|
||||||
|
CMD ["serve", "-s", "dist", "-l", "6000"]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const DEFAULT_API_BASE_URL = 'http://localhost:8000/api';
|
const DEFAULT_API_BASE_URL = 'http://localhost:8100/api';
|
||||||
|
|
||||||
const trimTrailingSlash = (value: string): string => value.replace(/\/+$/, '');
|
const trimTrailingSlash = (value: string): string => value.replace(/\/+$/, '');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user