version: '3.8'

services:
  deric:
    image: registry.gitlab.com/rechtlogischshared/da/deric:${TAG:-main}
    container_name: deric
    build:
      context: .
      target: ${TARGET:-local}
      dockerfile: ./docker/deric/${WEBSERVER:-apache}.dockerfile
    ports:
      - ${DERIC_PORT:-80}:8080
    environment:
      REDIS_HOST: ${REDIS_HOST:-elster.rechtlogisch.de}
      REDIS_PASSWORD: ${REDIS_PASSWORD:-Sup3rDUp3rS1chEresZ3c7Et}
      REDIS_PORT: ${REDIS_PORT:-63790}
      REDIS_USERNAME: ${REDIS_USERNAME:-custom_username}
    volumes:
      - ./api:${API_TARGET:-/var/www/api}:delegated
    depends_on:
      - db
      - s3

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

  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}
