name: oif

services:

  api:
    build:
      context: .
      dockerfile: ./docker/django/Dockerfile
    container_name: api
    environment:
      POSTGRES_USER: oifadmin
      POSTGRES_PASSWORD: Oif@cartographie2024
      POSTGRES_DB: cartographie
    ports:
      - "8000:8000"
    volumes:
      - .:/orgfranco
    networks:
      - net
    tty: true
    restart: always
    command: "python manage.py runserver 0.0.0.0:8000"

  db:
    image: postgres:16-alpine
    container_name: db
    restart: always
    volumes:
      - data:/var/lib/postgresql/data
      - ./docker/postgresql/dumps/init.sql:/docker-entrypoint-initdb.d/init.sql
    environment:
      POSTGRES_USER: oifadmin
      POSTGRES_PASSWORD: Oif@cartographie2024
      POSTGRES_DB: cartographie
      PGDATA: "data:/var/lib/postgresql/pgdata"
    networks:
      - net
    ports:
      - "5432:5432"

  keycloak:
    build: ./docker/keycloak
    container_name: keycloak
    ports:
      - "8080:8080"
      - "8443:8443"
    depends_on:
      - db
    networks:
      - net

  frontend:
    build: ./oif-frontend
    container_name: frontend
    ports:
#      - "80:80"
      - "3000:80"
    networks:
      - net

  redis:
    image: redis:alpine
    networks:
      - net
volumes:
  data:
networks:
  net:
