volumes:
  diarios_oficiais_alems_local_postgres_data: {}
  diarios_oficiais_alems_local_postgres_data_backups: {}
  esdata:

services:
  django:
    build:
      context: .
      dockerfile: ./compose/local/django/Dockerfile
    image: diarios_oficiais_alems_local_django
    container_name: diarios_oficiais_alems_local_django
    depends_on:
      - postgres
      - elasticsearch
    volumes:
      - .:/app:z
    env_file:
      - ./.envs/.local/.django
      - ./.envs/.local/.postgres
    ports:
      - '8005:8005'
    command: /start
    restart: unless-stopped

  nginx:
    image: nginx:latest
    container_name: diarios_oficiais_alems_local_nginx
    volumes:
      - ./compose/local/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
      - ./staticfiles:/app/staticfiles:ro
      - ./mediafiles:/app/mediafiles:ro
    ports:
      - "80:80"
    depends_on:
      - django
    restart: unless-stopped
      

  postgres:
    build:
      context: .
      dockerfile: ./compose/production/postgres/Dockerfile
    image: diarios_oficiais_alems_production_postgres
    container_name: diarios_oficiais_alems_local_postgres
    volumes:
      - diarios_oficiais_alems_local_postgres_data:/var/lib/postgresql/data
      - diarios_oficiais_alems_local_postgres_data_backups:/backups
    env_file:
      - ./.envs/.local/.postgres

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.17.3
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    volumes:
      - esdata:/usr/share/elasticsearch/data

