version: '3.4'
name: dev

services:
  managing.api:
    image: ${DOCKER_REGISTRY-}managingapi
    build:
      context: .
      dockerfile: Managing.Api/Dockerfile
    networks:
      - managing-network

  managing.api.workers:
    image: ${DOCKER_REGISTRY-}managingapiworkers
    build:
      context: .
      dockerfile: Managing.Api.Workers/Dockerfile
    networks:
      - managing-network

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - managing-network
    restart: unless-stopped
    environment:
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
    command: >
      sh -c "
        if [ -n \"$$REDIS_PASSWORD\" ]; then
          redis-server --appendonly yes --requirepass $$REDIS_PASSWORD
        else
          redis-server --appendonly yes
        fi
      "

volumes:
  redis_data:

networks:
  managing-network:
    external:
      name: managing-network