version: '3.8'

services:
  deric:
    image: registry.gitlab.com/rechtlogischshared/da/deric:${TAG:-feat-postgres}
    container_name: deric
    environment:
      DB_CONNECTION: ${DB_CONNECTION:-pgsql}
      DB_PASSWORD: ${DB_PASSWORD:-postgres}
      DB_PORT: ${DB_PORT:-5432}
      DB_USERNAME: ${DB_USERNAME:-postgres}
    ports:
      - ${DERIC_PORT:-80}:8080
    depends_on:
      - db
      - cache
      - s3

  db:
    image: postgres
    container_name: db
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
      POSTGRES_DB: ${DB_DATABASE:-deric}
    volumes:
      - dev-deric-pgsql:/var/lib/postgresql/data

  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-pgsql:
  dev-deric-s3:

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