mirror of
https://github.com/casjaysdevdocker/aria2
synced 2026-05-19 02:47:48 -04:00
Some checks failed
aria2 / release-aria2 (push) Failing after 6m58s
AI.md CLAUDE.md Dockerfile .env.scripts IDEA.md README.md rootfs/root/docker/setup/00-init.sh rootfs/root/docker/setup/01-system.sh rootfs/root/docker/setup/02-packages.sh rootfs/root/docker/setup/03-files.sh rootfs/root/docker/setup/04-users.sh rootfs/root/docker/setup/06-post.sh rootfs/root/docker/setup/07-cleanup.sh rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/etc/docker/init.d/00-aria2c.sh TODO.AI.md
3.8 KiB
3.8 KiB
aria2 — THE HOW
Build flow
Multi-stage Alpine Dockerfile (casjaysdev/alpine base → FROM scratch final).
- Package install:
pkmgr install aria2 bash tini curl wget tzdata ca-certificates unzip jq pwgen nginxinstalls all components in one layer. - Setup scripts (
rootfs/root/docker/setup/):03-files.shauto-installs everything underrootfs/tmp/into the image (/etc/aria2/,/etc/nginx/,/usr/local/etc/docker/bin/, etc.).05-custom.shperforms the wipe-and-replace — removes distro defaults from/etc/aria2/and/etc/nginx/, installs our optimized configs, and unpacks the pre-bundled AriaNg zip fromrootfs/tmp/ariang-src/AriaNg-*.zipinto/usr/local/share/ariang/. - AriaNg pre-bundle: GitHub SSL is blocked inside the buildx sandbox on this host, so the AriaNg zip must be downloaded on the host first and placed at
rootfs/tmp/ariang-src/AriaNg-1.3.13.zip(gitignored) before runningbuildx. - Final stage:
FROM scratch+COPY --from=build /. /produces a minimal image with tini as PID 1.
Runtime boot chain
tini → /usr/local/bin/entrypoint.sh → /usr/local/etc/docker/init.d/00-aria2c.sh → /usr/local/etc/docker/bin/start-aria2
entrypoint.shseeds/config/and/data/on first run (via__initialize_config_dir/__initialize_data_dir), then calls__start_init_scriptswhich sources and executesinit.d/00-aria2c.sh.00-aria2c.shsourcesfunctions/entrypoint.sh, runs hook functions (__run_pre_execute_checks→tracker.shto refresh BT trackers;__update_conf_files→ token substitution:REPLACE_RPC_PORT,REPLACE_SERVER_ADDR, optionalrpc-secrettoggle, DHT port, log path, file-allocation, AriaNg config overlay), then calls the framework's__run_start_script.start-aria2backgroundsaria2c --conf-path=/config/aria2/aria2.conf, waits for port 6800 to open, thenexecsnginx -c /config/nginx/nginx.conf -g 'daemon off;'as the foreground process (becomes PID adopted by tini).
Key paths
| Path | Role |
|---|---|
/usr/bin/aria2c |
Download daemon binary |
/usr/sbin/nginx |
HTTP server binary |
/usr/local/share/ariang/ |
AriaNg static files (index.html, JS, CSS) |
/usr/local/etc/docker/bin/start-aria2 |
Wrapper: backgrounds aria2c, foregrounds nginx |
/usr/local/etc/docker/init.d/00-aria2c.sh |
Init.d script — wires up the service |
/usr/local/bin/tracker.sh |
P3TERX BT tracker updater |
/config/aria2/aria2.conf |
User-editable aria2c config (seeded from rootfs/tmp/etc/aria2/aria2.conf) |
/config/nginx/nginx.conf |
User-editable nginx config (seeded from rootfs/tmp/etc/nginx/nginx.conf) |
/data/downloads/aria2/ |
Download destination |
/data/logs/aria2/aria2.log |
aria2c log |
/data/logs/nginx/ |
nginx access + error logs |
Config token substitution (00-aria2c.sh __update_conf_files)
Tokens in /config/aria2/aria2.conf replaced at each container start:
| Token | Replaced with |
|---|---|
REPLACE_RPC_PORT |
${RPC_PORT:-6800} |
REPLACE_SERVER_ADDR |
Container IPv4 (via __get_ip4) |
rpc-secret=REPLACE_RPC_SECRET |
Commented out unless RPC_SECRET env var is set |
dht-listen-port=.* |
dht-listen-port=6888 |
log=.* |
log=/data/logs/aria2/aria2.log |
file-allocation=.* |
file-allocation=prealloc |
The AriaNg client config (/config/aria2/aria-ng.config.js) is also overlaid onto the bundled js/aria-ng-*.min.js so the UI auto-connects to the local RPC endpoint without user configuration.
Single init.d design
The framework's __start_init_scripts only reliably runs the first init.d/*.sh. Two separate scripts (00-aria2c.sh + zz-nginx.sh) would only start aria2c. The resolution is a single init.d entry (00-aria2c.sh) pointing at the start-aria2 wrapper script which manages both processes.