name: b2bcall networks: b2bcall-net: driver: bridge volumes: postgres-data: redis-data: services: postgres: image: postgres:17-alpine container_name: b2bcall-postgres restart: unless-stopped environment: POSTGRES_DB: ${POSTGRES_DB:-b2bcall} POSTGRES_USER: ${POSTGRES_USER:-b2bcall} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} volumes: - postgres-data:/var/lib/postgresql/data - ./infrastructure/postgres/init:/docker-entrypoint-initdb.d:ro networks: - b2bcall-net # Sem "ports": Postgres não deve ficar acessível fora da rede Docker interna. healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-b2bcall} -d ${POSTGRES_DB:-b2bcall}"] interval: 10s timeout: 5s retries: 5 start_period: 10s logging: driver: json-file options: max-size: "10m" max-file: "3" deploy: resources: limits: memory: 512M redis: image: redis:7-alpine container_name: b2bcall-redis restart: unless-stopped environment: REDIS_PASSWORD: ${REDIS_PASSWORD:?REDIS_PASSWORD is required} command: > redis-server --requirepass ${REDIS_PASSWORD:?REDIS_PASSWORD is required} --maxmemory 100mb --maxmemory-policy noeviction --appendonly yes volumes: - redis-data:/data networks: - b2bcall-net # Sem "ports": Redis não deve ficar acessível fora da rede Docker interna. healthcheck: test: ["CMD-SHELL", "redis-cli -a $$REDIS_PASSWORD --no-auth-warning ping | grep -q PONG"] interval: 10s timeout: 5s retries: 5 start_period: 5s logging: driver: json-file options: max-size: "10m" max-file: "3" deploy: resources: limits: memory: 160M