name: devplace

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    restart: unless-stopped
    env_file:
      - .env
    user: "${DEVPLACE_UID:-1000}:${DEVPLACE_GID:-1000}"
    working_dir: /app
    environment:
      HOME: /app
      PYTHONDONTWRITEBYTECODE: "1"
    volumes:
      - .:/app
    expose:
      - "10500"
    networks:
      - appnet
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:10500/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 120s
      start_interval: 2s

  nginx:
    build:
      context: .
      dockerfile: nginx/Dockerfile
    restart: unless-stopped
    ports:
      - "127.0.0.1:${PORT:-10500}:80"
    environment:
      NGINX_CACHE_ENABLED: "${NGINX_CACHE_ENABLED:-false}"
      NGINX_CACHE_MAX_SIZE: "${NGINX_CACHE_MAX_SIZE:-1g}"
      NGINX_MAX_BODY_SIZE: "${NGINX_MAX_BODY_SIZE:-50m}"
    volumes:
      - ./devplacepy/static:/app/static:ro
      - ${DEVPLACE_DATA_DIR:-./data}/uploads:/data/uploads:ro
    depends_on:
      app:
        condition: service_healthy
    networks:
      - appnet

networks:
  appnet:
    driver: bridge
