version: "3.8"

services:
  db_anthophila:
    image: postgres
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    env_file: .env
    ports:
      - "5438:5432"

  backend:
    build:
      context: . # Répertoire racine Anthophila_dk/
      dockerfile: ./Anthophila/Dockerfile

    command: python Anthophila/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    env_file: .env
    ports:
      - "8008:8000"
    environment:
      - DEBUG=${DEBUG}
      - SECRET_KEY=${SECRET_KEY}
      - DB_NAME=${DB_NAME}
      - DB_USER=${DB_USER}
      - DB_PASS=${DB_PASSWORD}
      - DB_HOST=${DB_HOST}
      - DB_PORT=${DB_PORT}
    depends_on:
      - db_anthophila
  frontend:
    build:
      context: .
      dockerfile: anthofront/Dockerfile
    ports:
      - "88:80"
    depends_on:
      - backend

  # nginx:
  #   image: nginx:alpine
  #   ports:
  #     - "8088:80"
  #   volumes:
  #     - ./nginx.conf:/etc/nginx/nginx.conf:ro
  #   depends_on:
  #     - frontend

volumes:
  postgres_data:
