version: '3'

services:
  web:
    user: ${UID:-0}:${GID:-0}
    image: pycs:latest
    container_name: pycs

    command: python app.py

    ports:
      - ${PORT:-5000}:5000

    volumes:
      - ./models:/pycs/models
      - ./labels:/pycs/labels
      - ./projects:/pycs/projects
      - ./db:/pycs/db
      - ./settings.json:/pycs/settings.json
      - ./external_data:/data

    depends_on:
      - migration

  migration:
    user: ${UID:-0}:${GID:-0}
    image: pycs:latest
    container_name: pycs_migrator
    command: flask db upgrade

    volumes:
      - ./db:/pycs/db
      - ./settings.json:/pycs/settings.json
