38 lines
933 B
YAML
38 lines
933 B
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASS}
|
|
POSTGRES_DB: ${DB_NAME}
|
|
ports:
|
|
- "127.0.0.1:5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -d ${DB_NAME} -U ${DB_USER}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
api:
|
|
build:
|
|
context: ./src/Web
|
|
dockerfile: Dockerfile
|
|
container_name: web-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5000:80"
|
|
environment:
|
|
- ASPNETCORE_ENVIRONMENT=Development
|
|
- ConnectionStrings__DbContext=Host=postgres;Port=5432;Database=${DB_NAME};Username=${DB_USER};Password=${DB_PASS}
|
|
- ASPNETCORE_URLS=http://+:80
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
postgres_data:
|