From 7a2b79af83a4dac1c87ebb27300d7a98c8f0fc69 Mon Sep 17 00:00:00 2001 From: WorkClub Automation Date: Tue, 3 Mar 2026 21:05:23 +0100 Subject: [PATCH] infra(docker-compose): add full-stack development environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- docker-compose.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8168023..689e626 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,51 @@ services: start-dev --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: postgres-data: driver: local