mediago-dev--mediago
b1cbb74f32
The image was failing at startup with:
flag provided but not defined: -m3u8-bin
mediago-core consolidated the per-downloader `--*-bin` flags into a
single `--deps-dir` in 3.5.0-beta.1, but the Dockerfile was still
passing the old five flags (`--m3u8-bin`, `--bilibili-bin`,
`--direct-bin`, `--mediago-bin`, `--ffmpeg-bin`). Go flag parsing
rejects unknown flags, so the container exited immediately.
While fixing, extracted the invocation into
`scripts/docker-entrypoint.sh` rather than leaving a nine-line
quoted-array `CMD` at the bottom of the Dockerfile:
- `exec mediago-core …` replaces the shell so SIGTERM from
`docker stop` reaches the Go process directly — no shell parent to
swallow signals.
- `"$@"` forwards any extra flags from `docker run image … --foo=bar`
so callers can override individual options without replacing the
whole command.
- Switching from `CMD` to `ENTRYPOINT` makes the script the fixed
launch path; runtime overrides still work via the forwarded `"$@"`.
- Editing default args no longer touches the Dockerfile (and thus
doesn't invalidate the full image layer).
New `.gitattributes` pins `*.sh` to LF line endings so a Windows
checkout doesn't turn the entrypoint into a `/bin/sh^M: bad interpreter`
error inside the Linux container.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 行
657 B
Bash
21 行
657 B
Bash
#!/bin/sh
|
|
# MediaGo Docker entrypoint.
|
|
#
|
|
# `exec` replaces the shell with mediago-core so signals (SIGTERM on
|
|
# `docker stop`) reach the Go process directly — no shell wrapper in the
|
|
# middle that would swallow them. `"$@"` forwards any extra args passed
|
|
# via `docker run ... mediago-core --foo=bar`, letting callers override
|
|
# individual flags without replacing the whole command.
|
|
set -e
|
|
|
|
exec mediago-core \
|
|
--port=8899 \
|
|
--static-dir=/app/static \
|
|
--enable-auth \
|
|
--db-path=/app/mediago/data/mediago.db \
|
|
--config-dir=/app/mediago/data \
|
|
--log-dir=/app/mediago/logs \
|
|
--local-dir=/app/mediago/downloads \
|
|
--deps-dir=/app/deps \
|
|
"$@"
|