version: '3'
services:
  postgres:
    image: postgres
    restart: always
    container_name: "${CONTAINER_NAME}_postgres"
    volumes:
      - "${POSTGRES_STORAGE}:/var/lib/postgresql/data"
    networks:
      - traderun_net
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE}

  website:
    restart: always
    build:
      context: .
      args:
        - no-cache
    container_name: "${CONTAINER_NAME}_webapp"
    volumes:
      - "${LIB_STORAGE}:/usr/local/lib/"
      # - "${PIP_STORAGE}:/root/.cache/pip"
    ports:
      - "${CONTAINER_OUT_PORT}:8000"
    networks:
      - traderun_net
    depends_on:
      - postgres
    env_file: .env

networks:
  traderun_net:
    driver: bridge
