video_press/docker-compose.yml

106 lines
4.4 KiB
YAML
Raw Normal View History

2026-03-09 17:42:26 -05:00
# =============================================================================
# VideoPress — docker-compose.yml
# =============================================================================
#
# Quick start:
# 1. Edit MEDIA_HOST_PATH below (or set it as a shell variable before running)
# 2. docker compose up -d
# 3. Open http://localhost:8080
#
# All configuration lives in the 'environment' section — no .env file needed
# for basic usage, though a .env file is supported (see comments below).
# =============================================================================
services:
videopress:
build:
context: .
dockerfile: Dockerfile
2026-03-09 17:42:26 -05:00
# ── Alternatively, use a pre-built image: ───────────────────────────────
# image: videopress:latest
2026-03-09 17:42:26 -05:00
container_name: videopress
# Run as UID:GID 1000:1000 (matches the 'appuser' created in the Dockerfile).
# This ensures the container can write to bind-mounted host directories
# that are owned by UID 1000.
user: "1000:1000"
2026-03-09 17:42:26 -05:00
restart: unless-stopped
# ── Port mapping ─────────────────────────────────────────────────────────
# Format: "HOST_PORT:CONTAINER_PORT"
# The UI and REST API are served on the same port — no separate API port
# is required. Change the host port (left side) as needed.
ports:
- "8080:8080"
# ── Volume mapping ────────────────────────────────────────────────────────
# Map the directory on your HOST that contains the video files into the
# container at /media (MEDIA_ROOT).
#
# *** Change /path/to/your/videos to the real path on your host. ***
#
# You can also set MEDIA_HOST_PATH as an environment variable before
# running docker compose:
# export MEDIA_HOST_PATH=/mnt/nas/videos && docker compose up -d
#
# IMPORTANT — before first run, create the data directory on the HOST
# and give it to UID 1000 (the container's non-root user) so SQLite can
# write the settings database:
#
# mkdir -p ./data
# chown 1000:1000 ./data
#
# If you skip this step Docker will create ./data as root and the
# container will fail to start with "unable to open database file".
2026-03-09 17:42:26 -05:00
volumes:
- ${MEDIA_HOST_PATH:-/path/to/your/videos}:/media
- ./data:/data
2026-03-09 17:42:26 -05:00
# ── Environment variables ─────────────────────────────────────────────────
environment:
# Path *inside the container* where videos are accessible.
# Must match the right-hand side of the volume mount above.
MEDIA_ROOT: /media
# SQLite database path inside the container.
# Must match the right-hand side of the ./data:/data volume mount.
DB_PATH: /data/videopress.db
2026-03-09 17:42:26 -05:00
# TCP port Gunicorn listens on (must match EXPOSE in Dockerfile and
# the right-hand side of the ports mapping above).
PORT: 8080
# Gunicorn log level: debug | info | warning | error | critical
LOG_LEVEL: info
# ── Resource limits (optional — uncomment to enable) ─────────────────────
# Compressing large video files is CPU-intensive. Limits prevent the
# container from starving other workloads on the host.
# deploy:
# resources:
# limits:
# cpus: '4'
# memory: 2G
# reservations:
# cpus: '1'
# memory: 512M
2026-03-09 17:42:26 -05:00
# ── Health check ──────────────────────────────────────────────────────────
healthcheck:
test: ["CMD", "python3", "-c",
"import urllib.request; urllib.request.urlopen('http://localhost:8080/')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# ── Logging ───────────────────────────────────────────────────────────────
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"