services:
  api:
    container_name: humand-main-api
    build:
      context: ../../
      dockerfile: humand-packages/monolith/Dockerfile.dev
      secrets:
        - codeartifact_auth_token
    env_file:
      - .env
    ports:
      - "8080:8080"
      - "9229:9229"
      - "50051:50051"
    volumes:
      - ../../humand-packages:/usr/humand-packages
    networks:
      - backend
    depends_on:
      - db
      - redis-cache

  db:
    image: postgres:17.7-alpine
    container_name: humand-db
    environment:
      POSTGRES_USER: humand_user
      POSTGRES_PASSWORD: humand_password
      POSTGRES_DB: humand_dev
    ports:
      - "5432:5432"
    networks:
      - backend

  redis-cache:
    image: redis:7.0.7-alpine
    container_name: humand-cache
    ports:
      - "6379:6379"
    command: redis-server --appendonly yes
    networks:
      - backend

networks:
  backend:
    driver: bridge

secrets:
  codeartifact_auth_token:
    environment: CODEARTIFACT_AUTH_TOKEN