优化 Docker 开发启动流程

This commit is contained in:
yml2213
2026-07-31 16:27:51 +08:00
parent 30362f14bd
commit a091806283
5 changed files with 86 additions and 45 deletions
+6 -1
View File
@@ -1,3 +1,5 @@
name: ${COMPOSE_PROJECT_NAME:-affiliate_dash}
services:
postgres:
image: ${POSTGRES_IMAGE:-docker.m.daocloud.io/library/postgres:16-alpine}
@@ -8,6 +10,8 @@ services:
- TZ=${TZ:-Asia/Shanghai}
- PGTZ=${TZ:-Asia/Shanghai}
command: ["postgres", "-c", "timezone=${TZ:-Asia/Shanghai}"]
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
restart: unless-stopped
@@ -34,7 +38,7 @@ services:
- PORT=8080
- TZ=${TZ:-Asia/Shanghai}
- JWT_SECRET=${JWT_SECRET}
- "DATABASE_URL=postgres://${POSTGRES_USER:-affiliate}:${POSTGRES_PASSWORD:-affiliate_dev_password}@postgres:5432/${POSTGRES_DB:-affiliate_dash}?sslmode=disable&TimeZone=${TZ:-Asia/Shanghai}"
- "DATABASE_URL=${DOCKER_DATABASE_URL:-postgres://${POSTGRES_USER:-affiliate}:${POSTGRES_PASSWORD:-affiliate_dev_password}@postgres:5432/${POSTGRES_DB:-affiliate_dash}?sslmode=disable&TimeZone=${TZ:-Asia/Shanghai}}"
- GIN_MODE=${GIN_MODE:-release}
- OPEN_API_KEY=${OPEN_API_KEY}
- OPEN_API_SECRET=${OPEN_API_SECRET}
@@ -79,6 +83,7 @@ services:
volumes:
postgres-data:
name: ${POSTGRES_DATA_VOLUME:-affiliate_dash_postgres_data}
backend-data:
caddy-data:
caddy-config: