Support host UID/GID for Docker runtime

This commit is contained in:
Dymas
2026-05-17 14:24:17 +02:00
parent 2734343904
commit 8ea43f1593
7 changed files with 64 additions and 4 deletions
+13 -1
View File
@@ -2,7 +2,7 @@
A local web UI for a system-wide `ani-cli` install.
Current version: `0.30.1`
Current version: `0.30.2`
## Project Layout
@@ -87,6 +87,8 @@ Run the container with the requested persistent mounts:
docker run --rm \
-p 8421:8421 \
-e UPDATE_ON_START=true \
-e USER_UID="$(id -u)" \
-e USER_GID="$(id -g)" \
-v "$(pwd)/downloads:/downloads" \
-v "$(pwd)/.ani-cli-web:/app/.ani-cli-web" \
ani-cli-web
@@ -98,6 +100,12 @@ Or start the same setup with Compose:
docker compose up --build -d
```
To keep mounted downloads owned by your host user, start Compose with:
```sh
USER_UID="$(id -u)" USER_GID="$(id -g)" docker compose up --build -d
```
The included `docker-compose.yaml` uses the same defaults as the `Dockerfile`, mounts `./downloads` to `/downloads`, mounts `./.ani-cli-web` to `/app/.ani-cli-web`, and lets you override build/runtime settings through environment variables such as:
```text
@@ -106,6 +114,8 @@ ANI_CLI_BRANCH=master
ANI_CLI_WEB=https://gitea.coreplay.eu/Dymas/ani-cli-web.git
ANI_CLI_WEB_PORT=8421
UPDATE_ON_START=false
USER_UID=
USER_GID=
ANI_CLI_WEB_ALLOW_REMOTE=false
ANI_CLI_WEB_REMOTE_TOKEN=
```
@@ -118,6 +128,7 @@ Container defaults:
- App state stays under `/app/.ani-cli-web`, so bind-mount `./.ani-cli-web:/app/.ani-cli-web`.
- The image sets `ANI_CLI_WEB_HOST=0.0.0.0` and exposes port `8421`.
- `UPDATE_ON_START=true` runs `sudo ani-cli --update` before the web app starts.
- Set `USER_UID` and `USER_GID` together to run the web app as a specific numeric host user/group, which keeps new files on mounted folders such as `./downloads` from being owned by `root`.
The installed `ani-cli` update URL is rewritten during the image build so `ani-cli --update` follows the same `ANI_CLI_BRANCH` you built into the image when the `ANI_CLI` remote is a GitHub repository.
@@ -364,6 +375,7 @@ Environment variables:
- `ANI_CLI_WEB_DEBUG`: enable debug logging when set to `1`, `true`, `yes`, or `on`.
- `ANI_CLI_WEB_STATE_ROOT`: override the project-local state directory path; useful for isolated test runs or custom storage locations.
- `UPDATE_ON_START`: when set to `1`, `true`, `yes`, or `on` in the container, runs `sudo ani-cli --update` before `ani-cli-web` starts.
- `USER_UID` and `USER_GID`: optional numeric UID/GID pair for running the container process as a specific host user/group so mounted files are created with that ownership.
Saved defaults from the UI are written into the project-local `config.json`.