version: '3.8' services: # PostgreSQL Database postgres: image: postgres:15-alpine container_name: shorter-postgres environment: POSTGRES_DB: shorter_db POSTGRES_USER: postgres POSTGRES_PASSWORD: password ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - shorter-network # Redis Cache redis: image: redis:7-alpine container_name: shorter-redis ports: - "6379:6379" volumes: - redis_data:/data networks: - shorter-network # Backend API backend: build: context: ./backend dockerfile: Dockerfile container_name: shorter-backend environment: DB_HOST: postgres DB_USER: postgres DB_PASSWORD: password DB_NAME: shorter_db DB_PORT: 5432 DB_SSLMODE: disable REDIS_HOST: redis REDIS_PORT: 6379 PORT: 8080 GIN_MODE: release ports: - "8080:8080" depends_on: - postgres - redis networks: - shorter-network restart: unless-stopped # Frontend frontend: build: context: ./frontend dockerfile: Dockerfile container_name: shorter-frontend environment: NEXT_PUBLIC_API_URL: http://localhost:8080/api ports: - "3000:3000" depends_on: - backend networks: - shorter-network restart: unless-stopped volumes: postgres_data: redis_data: networks: shorter-network: driver: bridge