services:
  nginx:
    container_name: nginx
#    volumes:
#      - website_data:/var/www/djangoserver
    develop:
      watch:
        - action: sync
          path: ./requirements/nginx/static
          target: /var/www/static
    networks:
      - transcendence
    depends_on:
      - djangoserver
    build: requirements/nginx
    ports:
      - "8000:8000"
    restart: always 

  djangoserver:
    container_name: djangoserver
    # volumes:
    #   - website_data:/var/www/djangoserver
    networks:
      - transcendence
    develop:
      watch:
        - action: sync+restart
          path: ./requirements/djangoserver/file/server
          target: /var/www/djangoserver/server
    build:
      context: requirements/djangoserver
      args:
        DB_NAME: ${DB_NAME}
        DB_USERNAME: ${DB_USERNAME}
        DB_PASSWORD: ${DB_PASSWORD}
        DB_HOST: ${DB_HOST}
        UID_42: ${UID_42}
        SECRET_42: ${SECRET_42}
        ICLOUD_USER: ${ICLOUD_USER}
        ICLOUD_PASS: ${ICLOUD_PASS}
        SERVER_URL: ${SERVER_URL}
    depends_on:
      - postgresql
    restart: always 

  postgresql:
    container_name: postgresql
    env_file: .env
    build: 
      context: requirements/postgresql
      args:
        DB_NAME: ${DB_NAME}
        DB_USERNAME: ${DB_USERNAME}
        DB_PASSWORD: ${DB_PASSWORD}
    networks:
      - transcendence
    restart: always 
  
  adminer: 
    container_name: adminer 
    image: adminer:latest
    restart: always
    networks:
      - transcendence 

volumes:
  website_data:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: '~/METH_data'

networks:
  transcendence:
    driver: bridge
