46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: dotnet-samples-aspnetcore-webapi
|
|
|
|
services:
|
|
api:
|
|
image: dotnet-samples-aspnetcore-webapi
|
|
container_name: aspnetcore-app
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "9000:9000"
|
|
volumes:
|
|
- storage:/storage/
|
|
environment:
|
|
- DATABASE_PROVIDER=${DATABASE_PROVIDER:-sqlite}
|
|
- DATABASE_URL=${DATABASE_URL:-Host=postgres;Database=players;Username=postgres;Password=postgres}
|
|
- STORAGE_PATH=/storage/players-sqlite3.db
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
required: false
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: aspnetcore-postgres
|
|
profiles: [postgres]
|
|
environment:
|
|
POSTGRES_DB: players
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
storage:
|
|
name: dotnet-samples-aspnetcore-webapi_storage
|
|
postgres-data:
|
|
name: dotnet-samples-aspnetcore-webapi_postgres-data
|