services: # ── 1. PostgreSQL Database ────────────────────────────────────────────────── postgres: image: postgres:16-alpine container_name: nitheeshwork-postgres restart: unless-stopped environment: POSTGRES_DB: taskdb POSTGRES_USER: taskuser POSTGRES_PASSWORD: taskpass volumes: - postgres_data:/var/lib/postgresql/data networks: - nitheeshwork-net healthcheck: test: ["CMD-SHELL", "pg_isready -U taskuser -d taskdb"] interval: 10s timeout: 5s retries: 5 # ── 2. Redis Cache ────────────────────────────────────────────────────────── redis: image: redis:7-alpine container_name: nitheeshwork-redis restart: unless-stopped command: redis-server --appendonly yes volumes: - redis_data:/data networks: - nitheeshwork-net healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # ── 3. Node.js/Express Backend API ───────────────────────────────────────── backend: build: context: ./backend dockerfile: Dockerfile container_name: nitheeshwork-backend restart: unless-stopped environment: POSTGRES_HOST: postgres POSTGRES_DB: taskdb POSTGRES_USER: taskuser POSTGRES_PASSWORD: taskpass REDIS_HOST: redis PORT: 4000 ports: - "4000:4000" depends_on: postgres: condition: service_healthy redis: condition: service_healthy networks: - nitheeshwork-net # ── 4. Nginx – Frontend + Reverse Proxy ──────────────────────────────────── frontend: image: nginx:1.25-alpine container_name: nitheeshwork-frontend restart: unless-stopped ports: - "8080:80" volumes: - ./frontend:/usr/share/nginx/html:ro - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - backend networks: - nitheeshwork-net # ── 5. pgAdmin – Database Web UI ─────────────────────────────────────────── pgadmin: image: dpage/pgadmin4:latest container_name: nitheeshwork-pgadmin restart: unless-stopped environment: PGADMIN_DEFAULT_EMAIL: admin@nitheeshwork.com PGADMIN_DEFAULT_PASSWORD: adminpass PGADMIN_CONFIG_SERVER_MODE: "False" PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" volumes: - pgadmin_data:/var/lib/pgadmin ports: - "5050:80" depends_on: - postgres networks: - nitheeshwork-net volumes: postgres_data: name: nitheeshwork-postgres-data redis_data: name: nitheeshwork-redis-data pgadmin_data: name: nitheeshwork-pgadmin-data networks: nitheeshwork-net: driver: bridge