feat: 完善后端脚手架基础能力
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
DATABASE_DRIVER: postgres
|
||||
DATABASE_DSN: postgres://skeleton:skeleton@postgres:5432/skeleton?sslmode=disable
|
||||
REDIS_ENABLED: "true"
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: "6379"
|
||||
JWT_SECRET: local-compose-secret-change-me
|
||||
TRACING_ENABLED: "true"
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: jaeger:4318
|
||||
OTEL_EXPORTER_OTLP_INSECURE: "true"
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
migrate:
|
||||
image: arigaio/atlas:latest
|
||||
command: migrate apply --url postgres://skeleton:skeleton@postgres:5432/skeleton?sslmode=disable --dir file:///migrations
|
||||
volumes:
|
||||
- ./migrations/postgres:/migrations:ro
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
environment:
|
||||
POSTGRES_USER: skeleton
|
||||
POSTGRES_PASSWORD: skeleton
|
||||
POSTGRES_DB: skeleton
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U skeleton"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
mysql:
|
||||
image: mysql:8.4
|
||||
profiles: ["mysql"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: skeleton
|
||||
MYSQL_USER: skeleton
|
||||
MYSQL_PASSWORD: skeleton
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-proot"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:1.68.0
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "4318:4318"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
mysql_data:
|
||||
Reference in New Issue
Block a user