version: '3.8' services: postgres: image: postgres:16-alpine container_name: postgres-auth environment: POSTGRES_USER: ${POSTGRES_USER:-devuser} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-devpass} POSTGRES_DB: ${POSTGRES_DB:-auth_db} ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql - ./postgres/postgres.conf:/etc/postgresql/postgresql.conf healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-devuser}"] interval: 5s timeout: 5s retries: 5 networks: - microservices-network redis: image: redis:7-alpine container_name: redis-cache command: redis-server /etc/redis/redis.conf ports: - "${REDIS_PORT:-6379}:6379" volumes: - redis_data:/data - ./redis/redis.conf:/etc/redis/redis.conf healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 networks: - microservices-network volumes: postgres_data: redis_data: networks: microservices-network: external: true