version: '3.7'

services:
  db:
    image: postgres:12-alpine
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    #    ports:
    #    - "5432:5432"
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
  mc_frontend:
    build:
      context: ./mc_frontend
      dockerfile: Dockerfile
    image: konstantinschulz/mc_frontend:latest
  mcserver:
    build:
      context: .
      dockerfile: mc_backend/Dockerfile
    command: [ "/home/mc/venv/bin/gunicorn", "-c", "mcserver/gunicorn_config.py", "app:app" ]
    depends_on:
      - db
    environment:
      - FLASK_APP=app.py
      - IS_THIS_A_DOCKER_CONTAINER=Yes
      - PYTHONPATH=/home/mc
    image: konstantinschulz/mcserver:latest
    ports:
      - "5000:5000"
    restart: always
    volumes:
      - ./mc_backend/mcserver/.env:/home/mc/mc_backend/mcserver/.env
  nginx:
    build:
      context: .
      dockerfile: ./nginx.dockerfile
    ports:
      - "80:80"
    restart: always
    volumes:
      - ./mc_frontend/nginx.conf:/etc/nginx/nginx.conf
volumes:
  db-data:
