diff --git a/.env.example b/.env.example index 4203597..95739ea 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,26 @@ +# ------------------------------------------------------------------------------ +# Production Environment Variables +# ------------------------------------------------------------------------------ + # Backend DEBUG=0 MAX_UPLOAD_SIZE_MB=500 -TEMP_DIR=/tmp/audio_splitter_web CLEANUP_AFTER_SECONDS=3600 -BACKEND_DATA_VOLUME=/tmp/audio_splitter_web + +# Backend data directory (bind mount) +# This directory will store all temporary files during splitting. +# It can get large (audio files), so place it on a partition with enough space. +BACKEND_DATA_DIR=/var/lib/audio_splitter_data + +# Ports BACKEND_PORT=8000 +FRONTEND_PORT=5173 + +# ------------------------------------------------------------------------------ +# Development Overrides (docker-compose.override.yaml) +# ------------------------------------------------------------------------------ +# These are only used when docker-compose.override.yaml is present. +# They override the production settings for local development. # Frontend (development) VITE_BACKEND_URL=http://localhost:8000 -FRONTEND_PORT=5173 diff --git a/docker-compose-prod.yaml b/docker-compose-prod.yaml deleted file mode 100644 index 8041bcc..0000000 --- a/docker-compose-prod.yaml +++ /dev/null @@ -1,28 +0,0 @@ -services: - backend: - image: git.vmn.su/max/audio_splitter_backend:latest - ports: - - "${BACKEND_PORT}:8000" - volumes: - - "${BACKEND_DATA_VOLUME}:/tmp/audio_splitter_web" - environment: - - PYTHONUNBUFFERED=1 - - DEBUG=1 - restart: unless-stopped - - frontend: - image: git.vmn.su/max/audio_splitter_frontend:latest - ports: - - "${FRONTEND_PORT}:80" - volumes: - - ./web/frontend:/app - - node_modules:/app/node_modules - environment: - - BACKEND_URL=http://backend:8000 - - VITE_BACKEND_URL=http://backend:8000 - depends_on: - - backend - restart: unless-stopped - -volumes: - node_modules: diff --git a/docker-compose.override.yaml b/docker-compose.override.yaml new file mode 100644 index 0000000..4c9b1fa --- /dev/null +++ b/docker-compose.override.yaml @@ -0,0 +1,37 @@ +services: + backend: + build: + context: . + dockerfile: web/backend/Dockerfile + volumes: + # Bind mount for source code (hot-reload for Python) + - ./web/backend:/app/backend + - ./audio_splitter:/app/audio_splitter + - ./setup.py:/app/setup.py + - ./pyproject.toml:/app/pyproject.toml + # Development data directory (overrides production) + - "./dev_data:/tmp/audio_splitter_web" + environment: + - DEBUG=1 + - PYTHONUNBUFFERED=1 + ports: + - "8000:8000" + + frontend: + build: + context: ./web/frontend + # Use the same Dockerfile, but override CMD for development + dockerfile: Dockerfile + command: ["npm", "run", "dev", "--", "--host", "0.0.0.0"] + volumes: + # Bind mount for source code (hot-reload for Vite) + - ./web/frontend:/app + - node_modules:/app/node_modules + environment: + - BACKEND_URL=http://backend:8000 + - VITE_BACKEND_URL=http://backend:8000 + ports: + - "5173:5173" + +volumes: + node_modules: diff --git a/docker-compose.yaml b/docker-compose.yaml index bd7a218..48151a8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,29 +1,21 @@ services: backend: - build: - context: . - dockerfile: web/backend/Dockerfile + image: git.vmn.su/max/audio_splitter_backend:latest ports: - - "8000:8000" + - "${BACKEND_PORT:-8000}:8000" volumes: - - /tmp/audio_splitter_web:/tmp/audio_splitter_web # Bind mount + # Bind mount for persistent data storage. + # Set BACKEND_DATA_DIR in .env to point to your data directory. + - "${BACKEND_DATA_DIR:-/var/lib/audio_splitter_data}:/tmp/audio_splitter_web" environment: - PYTHONUNBUFFERED=1 - - DEBUG=1 + - DEBUG=${DEBUG:-0} restart: unless-stopped frontend: - build: - context: ./web/frontend - dockerfile: Dockerfile + image: git.vmn.su/max/audio_splitter_frontend:latest ports: - - "5173:80" - volumes: - - ./web/frontend:/app - - /app/node_modules - environment: - - BACKEND_URL=http://backend:8000 - - VITE_BACKEND_URL=http://backend:8000 + - "${FRONTEND_PORT:-5173}:80" depends_on: - backend restart: unless-stopped