version: "3.9"

services:
  postgres:
    image: postgres
    container_name: postgres
    volums: 
      - ~/.pg/pg_data/flask-yt:/var/lib/postgresql/data
    env_file:
      - .env
    ports:
      - "54321:5432"
  flask: 
    build:
      dockerfile: Dockerfile
      context: .
    container_name: flask
    volums:
      - ~/.uploads/images/flask-yt:/app/app/static/upload
    env_file:
      - .env
    environment:
      - POSTGRES_HOST=${POSTGRES_HOST}
      - POSTGRES_PORT=${POSTGRES_PORT}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    depends_on:
      - postgres
    expose:
      - 8080
  ngnix:
    build:
      dockerfile: ./Dockerfile
      context: ./ngnix/
    container_name: ngnix
    env_file:
      - .env
    depends_on:
      - flask
    ports:
      - "8080:80"