services:
  postgres:
    image: postgres:15-alpine
    container_name: taal-academiearreebzh_postgres
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data:z
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: unless-stopped
  django:
    build: ./django
    container_name: taal-academiearreebzh_django
    depends_on:
      postgres:
        condition: service_healthy
    command: sh -c "python manage.py makemigrations &&
      python manage.py migrate &&
      python manage.py collectstatic --clear --noinput &&
      gunicorn config.wsgi --bind 0.0.0.0:8001"
    volumes:
      - ./volumes/static:/django/static:z
    restart: unless-stopped
  nginx:
    build: ./nginx
    container_name: taal-academiearreebzh_nginx
    depends_on:
      - django
    volumes:
      - ./volumes/static:/django/static:z
    restart: unless-stopped
