From 153d5ba92c4ec1b3632da3136b9edfe414d8ae2a Mon Sep 17 00:00:00 2001 From: JB Date: Mon, 6 Oct 2025 14:42:54 -0700 Subject: [PATCH] feat: Update environment configuration for Docker to include temporary directory settings --- .env.example | 7 ++++++- README.md | 6 +++++- abogen/Dockerfile | 5 +++-- docker-compose.yaml | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 1ec0651..0cffb77 100644 --- a/.env.example +++ b/.env.example @@ -2,9 +2,14 @@ # Relative paths are resolved from the repository root when running locally. ABOGEN_SETTINGS_DIR=./config -ABOGEN_TEMP_DIR=./storage/tmp ABOGEN_OUTPUT_DIR=./storage/output +# Temporary working directory. When running in Docker, keep this inside the +# mounted /data volume so non-root users can write to it. For local (non-Docker) +# usage, change this to a path that makes sense on your machine or comment it out +# to fall back to the OS cache directory. +ABOGEN_TEMP_DIR=/data/cache + # UID/GID used when running the Docker container. 1000:1000 matches most Linux hosts. # Find your current values with: # id -u # UID diff --git a/README.md b/README.md index aeec516..ace3d4b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Browse to http://localhost:8808. Uploaded source files are stored in `/data/uplo | `ABOGEN_OUTPUT_ROOT` | `/data/outputs` | Directory for generated audio and subtitles | | `ABOGEN_UID` | `1000` | UID that the container should run as (matches host user) | | `ABOGEN_GID` | `1000` | GID that the container should run as (matches host group) | -| `ABOGEN_TEMP_DIR` | Platform cache dir (e.g. `~/.cache/abogen`) | Override the cache/temp directory | +| `ABOGEN_TEMP_DIR` | `/data/cache` (Docker) or platform cache dir | Override the cache/temp directory | | `ABOGEN_OUTPUT_DIR` | Same as `ABOGEN_OUTPUT_ROOT` | Override the rendered output directory | | `ABOGEN_SETTINGS_DIR` | Platform config dir (e.g. `~/.config/abogen`) | Override where JSON settings (profiles, config) are stored | @@ -67,6 +67,10 @@ id -g Use those values to populate `ABOGEN_UID` / `ABOGEN_GID` in your `.env` file. +When running via Docker Compose, the container defaults to `/data/cache` for +temporary files. Make sure the corresponding host directory is writable (the +compose volume at `${ABOGEN_DATA:-./data}` will automatically satisfy this). + ### Docker Compose (GPU by default) The repo includes `docker-compose.yaml`, which targets GPU hosts out of the box. Install the NVIDIA Container Toolkit and run: diff --git a/abogen/Dockerfile b/abogen/Dockerfile index e389de3..81a2954 100644 --- a/abogen/Dockerfile +++ b/abogen/Dockerfile @@ -44,8 +44,9 @@ EXPOSE 8808 VOLUME ["/data"] ENV ABOGEN_UPLOAD_ROOT=/data/uploads \ - ABOGEN_OUTPUT_ROOT=/data/outputs + ABOGEN_OUTPUT_ROOT=/data/outputs \ + ABOGEN_TEMP_DIR=/data/cache -RUN mkdir -p /data/uploads /data/outputs +RUN mkdir -p /data/uploads /data/outputs /data/cache CMD ["abogen"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 3564a48..4d9c882 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -17,6 +17,7 @@ services: ABOGEN_PORT: 8808 ABOGEN_UPLOAD_ROOT: /data/uploads ABOGEN_OUTPUT_ROOT: /data/outputs + ABOGEN_TEMP_DIR: "${ABOGEN_TEMP_DIR:-/data/cache}" # --- GPU support ----------------------------------------------------- # These settings assume the NVIDIA Container Toolkit is installed. # Leave them in place for GPU acceleration; comment out the entire block