infra(docker-compose): add full-stack development environment

Implements Task 22: Docker Compose Full Stack with Hot Reload

Services added:
- dotnet-api: Builds from backend/Dockerfile.dev
  - Port 5000→8080, volume mount for hot reload
  - Development environment with database + Keycloak config
  - Depends on: postgres (healthy), keycloak (healthy)

- nextjs: Builds from frontend/Dockerfile.dev
  - Port 3000, volume mount with node_modules exclusion
  - API URLs, NextAuth, Keycloak config
  - Depends on: dotnet-api

Dependency chain: postgres → keycloak → dotnet-api → nextjs

Features:
- Hot reload enabled via volume mounts with :cached flag (macOS)
- Backend runs migrations + seed on startup (Development mode)
- dotnet watch monitors backend changes
- bun run dev monitors frontend changes
- All services on app-network bridge

Environment variables configured for local development.

Note: Docker build/runtime verification skipped (Docker daemon unavailable).
This commit is contained in:
WorkClub Automation
2026-03-03 21:05:23 +01:00
parent 6124557f11
commit 7a2b79af83

View File

@@ -58,6 +58,51 @@ services:
start-dev start-dev
--import-realm --import-realm
dotnet-api:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: workclub_api
environment:
ASPNETCORE_ENVIRONMENT: Development
ConnectionStrings__DefaultConnection: "Host=postgres;Port=5432;Database=workclub;Username=workclub;Password=dev_password_change_in_production"
Keycloak__Authority: "http://keycloak:8080/realms/workclub"
Keycloak__Audience: "workclub-api"
ports:
- "5000:8080"
volumes:
- ./backend:/app:cached
depends_on:
postgres:
condition: service_healthy
keycloak:
condition: service_healthy
networks:
- app-network
nextjs:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: workclub_frontend
environment:
NEXT_PUBLIC_API_URL: "http://localhost:5000"
API_INTERNAL_URL: "http://dotnet-api:8080"
NEXTAUTH_URL: "http://localhost:3000"
NEXTAUTH_SECRET: "dev-secret-change-in-production-use-openssl-rand-base64-32"
KEYCLOAK_ID: "workclub-api"
KEYCLOAK_SECRET: "dev-secret-workclub-api-change-in-production"
KEYCLOAK_ISSUER: "http://localhost:8080/realms/workclub"
ports:
- "3000:3000"
volumes:
- ./frontend:/app:cached
- /app/node_modules
depends_on:
- dotnet-api
networks:
- app-network
volumes: volumes:
postgres-data: postgres-data:
driver: local driver: local