services:
  deric:
    image: registry.rechtlogisch.de/bb/deric:${TAG:-main}
    container_name: deric
    ports:
      - ${DERIC_PORT:-80}:8080
    depends_on:
      - db
      - cache
      - s3

  db:
    image: mysql:8
    container_name: db
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
      MYSQL_DATABASE: ${DB_DATABASE:-deric}
    volumes:
      - dev-deric-db:/var/lib/mysql

  cache:
    image: redis
    container_name: cache

  s3:
    image: minio/minio
    container_name: s3
    volumes:
      - dev-deric-s3:/data
    ports:
      - ${MINIO_PORT:-8081}:9000
    entrypoint: sh
    command: -c 'mkdir -p /data/${AWS_BUCKET:-deric} && minio server /data'

volumes:
  dev-deric-db:
  dev-deric-s3:

networks:
  default:
    name: ${NETWORK:-deric_default}
