version: "3.8"
services:

  db:
    image: postgres
    restart: always
    environment:
      - POSTGRES_ROOT_PASSWORD
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
    volumes:
      - ../postgres/:/var/lib/postgresql
    env_file:
      - .env
    networks:
      - nginx_network

  comfy:
    build:
      dockerfile: Dockerfile
      context: ./
    user: "${UID}:${GID}"
    restart: always
    ports:
      - "8000:8000"
    volumes:
      - ./:/app
    environment:
      - SECRET_KEY
      - DATABASE_URL
      - DJANGO_SETTINGS_MODULE
    env_file:
      - .env
    depends_on:
      - db
    networks:
      - nginx_network

  web:
    image: nginx
    restart: always
    volumes:
      - ../nginx/conf.d/:/etc/nginx/conf.d/
      - ./static/:/opt/services/comfy/static
      - ./media/:/opt/services/comfy/media 
    ports:
      - "8000:80"
    environment:
      - NGINX_HOST=artel.tepewu.pl
      - NGINX_PORT=80
    networks:
      - nginx_network

networks:
  nginx_network:
    driver: bridge
