services:
  frontend:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - BACKEND_URL=http://proxy:4321
    depends_on:
      - backend

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    env_file:
      - ./backend/.env.local
    environment:
      - NODE_ENV=production
      - PORT=8080
      - DATABASE_PATH=/app/data/gallus_cms.db
      - GIT_WORKSPACE_DIR=/app/workspace
    volumes:
      - backend_data:/app/data
      - backend_workspace:/app/workspace

  proxy:
    build:
      context: .
      dockerfile: Dockerfile.caddy
    depends_on:
      - frontend
      - backend
    ports:
      - "4321:80"

volumes:
  backend_data:
  backend_workspace: