dockerfix
This commit is contained in:
@@ -193,9 +193,11 @@ npm install
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
默认会监听 `8451` 端口,并自动把 `/api`、`/media` 代理到 `http://localhost:8000`。
|
||||||
|
|
||||||
### 3. 打开页面
|
### 3. 打开页面
|
||||||
|
|
||||||
- 前端:http://localhost:5173
|
- 前端:http://localhost:8451
|
||||||
- 后端:http://localhost:8000
|
- 后端:http://localhost:8000
|
||||||
- 健康检查:http://localhost:8000/api/health
|
- 健康检查:http://localhost:8000/api/health
|
||||||
|
|
||||||
@@ -209,7 +211,7 @@ docker compose up --build
|
|||||||
|
|
||||||
启动后访问:
|
启动后访问:
|
||||||
|
|
||||||
- 前端:http://localhost:8080
|
- 前端:http://localhost:8451
|
||||||
- 后端 API:http://localhost:8000
|
- 后端 API:http://localhost:8000
|
||||||
- 健康检查:http://localhost:8000/api/health
|
- 健康检查:http://localhost:8000/api/health
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
FROM python:3.12-slim
|
# syntax=docker/dockerfile:1.7
|
||||||
|
|
||||||
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
WORKDIR /app/backend
|
WORKDIR /app/backend
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
|
||||||
|
&& sed -i 's|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
|
apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends ffmpeg \
|
&& apt-get install -y --no-install-recommends ffmpeg \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from app.services.tasks import task_manager
|
|||||||
|
|
||||||
|
|
||||||
def get_allowed_origins() -> List[str]:
|
def get_allowed_origins() -> List[str]:
|
||||||
origins = os.getenv("CORS_ORIGINS", "http://localhost:5173,http://localhost:8080")
|
origins = os.getenv("CORS_ORIGINS", "http://localhost:8451,http://localhost:8080")
|
||||||
return [origin.strip() for origin in origins.split(",") if origin.strip()]
|
return [origin.strip() for origin in origins.split(",") if origin.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
dockerfile: backend/Dockerfile
|
dockerfile: backend/Dockerfile
|
||||||
container_name: vplatform-backend
|
container_name: vplatform-backend
|
||||||
environment:
|
environment:
|
||||||
CORS_ORIGINS: http://localhost:5173,http://localhost:8080
|
CORS_ORIGINS: http://localhost:8451,http://localhost:8080
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -22,5 +22,5 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
ports:
|
ports:
|
||||||
- "8080:80"
|
- "8451:80"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -4,6 +4,17 @@ import react from '@vitejs/plugin-react'
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
port: 5173,
|
host: '0.0.0.0',
|
||||||
|
port: 8451,
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://localhost:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
'/media': {
|
||||||
|
target: 'http://localhost:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user