# Containerization ## Docker Image **Base image**: `mcr.microsoft.com/dotnet/aspnet:8.0` **Build image**: `mcr.microsoft.com/dotnet/sdk:8.0` **Build strategy**: Multi-stage (restore → build → publish → runtime) **Exposed ports**: 8080 (HTTP), 8081 (management/metrics) ## Container Composition (docker-compose.yml) | Service | Image | Ports (host:container) | Purpose | |---------|-------|------------------------|---------| | postgres | postgres:16 | 5432:5432 | Database | | api | Custom (Dockerfile) | 18980:8080, 18981:8081 | Application | ## Volumes | Mount | Container Path | Purpose | |-------|---------------|---------| | ./tiles | /app/tiles | Tile image storage | | ./ready | /app/ready | Output artifacts (CSV, summary, stitched, ZIP) | | ./logs | /app/logs | Serilog file output | | postgres_data (named) | /var/lib/postgresql/data | Database persistence | ## Health Checks - **PostgreSQL**: `pg_isready -U postgres` (interval 5s, timeout 5s, retries 5) - **API**: depends on postgres health (startup ordering) ## Environment Variables | Variable | Source | Purpose | |----------|--------|---------| | ASPNETCORE_ENVIRONMENT | docker-compose | Environment selection | | ASPNETCORE_URLS | docker-compose | Listen address | | ConnectionStrings__DefaultConnection | docker-compose | DB connection string | | MapConfig__ApiKey | Host env `GOOGLE_MAPS_API_KEY` | Google Maps API key | | AZAION_REVISION | Build arg (CI_COMMIT_SHA) | Git revision tracking | ## Build Labels (OCI) - `org.opencontainers.image.revision` — Git commit SHA - `org.opencontainers.image.created` — Build timestamp - `org.opencontainers.image.source` — Repository URL