chore(devops): 本地/compose 宿主端口 +1000 防冲突(web 4000 / api 9000 / pg 6432)+ 文档登记

This commit is contained in:
Yaojia Wang
2026-07-08 17:33:43 +02:00
parent 2145d33cc7
commit c34dbf5d2d
4 changed files with 20 additions and 15 deletions

View File

@@ -5,8 +5,9 @@ services:
POSTGRES_USER: writer
POSTGRES_PASSWORD: writer
POSTGRES_DB: writer
# 宿主端口 +1000 防与其他项目冲突(容器内仍 5432
ports:
- "5432:5432"
- "6432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U writer"]
interval: 5s
@@ -24,12 +25,13 @@ services:
DATABASE_URL_SYNC: postgresql+psycopg://writer:writer@pg:5432/writer
APP_ENV: ${APP_ENV:-dev}
LOG_JSON: ${LOG_JSON:-false}
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:4000,http://127.0.0.1:4000}
# Fernet 加密 keyapi 启动即校验,缺失/非法则拒绝启动。compose 自动读根 .env 覆盖此默认;
# 默认值 = .env.example 的 dev 占位 key保证 `docker compose up` 无 .env 也能起(勿用于生产)。
CREDENTIAL_ENC_KEY: ${CREDENTIAL_ENC_KEY:-cnMpG6QQxJejuDLHTe_S-nq2snoKgXCqWFfsctEHB-4=}
# 宿主端口 +1000 防冲突(容器内仍 8000
ports:
- "8000:8000"
- "9000:8000"
depends_on:
pg:
condition: service_healthy
@@ -39,13 +41,14 @@ services:
context: ./apps/web
# NEXT_PUBLIC_API_BASE 为构建期内联,须经 build arg 传入(见 apps/web/Dockerfile
args:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:8000}
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:9000}
environment:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:8000}
# RSC 服务端取数走容器内网直连 api否则回退 localhost:8000 打不到 api 容器)。
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:9000}
# RSC 服务端取数走容器内网直连 api否则回退打不到 api 容器)。
API_BASE_INTERNAL: http://api:8000
# 宿主端口 +1000 防冲突(容器内仍 3000
ports:
- "3000:3000"
- "4000:3000"
depends_on:
- api