Repository navigation
ci: publish the Docker image to Docker Hub on every release - #53
Merged
Merged
Conversation
The slate shown when a channel cannot play draws its text with ffmpeg, which needs a font file from a fixed list. Alpine's font-dejavu puts DejaVuSans.ttf in /usr/share/fonts/dejavu/, which was not on it, so on Alpine the slate came out with no words on it.
ffmpeg plays RTSP channels and fragmented MP4 HLS, and draws the slate shown when a channel fails. Someone running the image cannot add it themselves, so both images now ship it, with a font for the slate's text. The image ran as the node user, uid 1000, from the start. A host folder that Docker creates for a bind mount belongs to root, so on a fresh install the app could not write settings.json and the container stopped. Unraid hits this on every new install, and wants 99:100 besides. The container now starts as root just long enough for docker/entrypoint.sh to hand the config and log folders to PUID:PGID, 1000:1000 by default, and then runs PlexIPTV as that user with setpriv: no supplementary groups, no capabilities, no new privileges. Started with --user, it skips all that. tini is now the first process. Node ignores docker stop when it is PID 1 and has no handler, which npm used to paper over by forwarding the signal. CMD is node itself, because npm wants a writable home folder an arbitrary PUID does not have. The code stays owned by root, so the app can no longer rewrite itself; only the config and log folders are its own. .gitattributes keeps the entrypoint at LF line endings, or a Windows checkout would break a locally built image.
The release publishes the images, so a Dockerfile that no longer builds, or an image that no longer starts, should fail a pull request rather than a tag. Each image is started the way Unraid starts it: on a folder owned by root, asked to run as 99:100. The job checks it answers, that settings.json ends up owned by 99:100, that node runs as uid 99, and that docker stop takes effect at once.
xiaodoudoufr/plexiptv on Docker Hub still had the 2018 images from the old automated builds, which Docker Hub has since retired, so docker pull gave you 1.0.3. A version tag now builds both images for amd64 and arm64 once the release job has passed, and pushes them: 1.6.1, 1.6 and latest from Dockerfile, and 1.6.1-alpine, 1.6-alpine and alpine from Dockerfile-alpine. latest is named per variant, because left to metadata-action the alpine build would push a plain latest too and overwrite the Debian one. A manual run builds no image. A last job copies docs/docker.md to the Docker Hub page. Docker Hub refuses that without a token carrying Delete scope, and the images are out by then, so its failure is reported without failing the release.
docs/docker.md was two sentences pointing at a 2018 image. It now covers the tags, running with docker run or Compose, PUID and PGID, the first start and the dashboard password, adding the tuner to Plex from a bridged container, ffmpeg, keeping the logs, and updating. The page doubles as the Docker Hub description, so its links are absolute: the action that copies it there would resolve relative ones against the repository root rather than docs/.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker pull xiaodoudoufr/plexiptvgave you 1.0.3, from 2018. Docker Hub's automated builds that made those images were retired, and nothing has published one since. The docs pointed every Docker user at it.From the next version tag on, the release workflow builds and pushes the image itself.
What a tag publishes
Once the existing release job has passed (lint, tests, binaries), both images are built for amd64 and arm64 from a fresh checkout and pushed:
Dockerfile(Debian)1.6.1,1.6,latestDockerfile-alpine1.6.1-alpine,1.6-alpine,alpinelatestis named per variant on purpose: left on auto, the alpine build would push a plainlatestas well and overwrite the Debian one. A manual run of the workflow builds no image.A last job copies
docs/docker.mdto the Docker Hub page. It cannot fail the release.The image itself
settings.jsonand the container stopped. Unraid hits this every time. The container now starts as root just long enough to hand the config and log folders toPUID:PGID(1000:1000 by default), then runs PlexIPTV as that user with no capabilities and no new privileges.--userstill works and skips all of it.docker stopreaches node. CMD isnodedirectly, since npm wants a writable home folder.One fix outside Docker: Alpine installs DejaVu in
/usr/share/fonts/dejavu/, which the slate did not look in.Tested
Docker is not on this Windows machine, so both images were built and run in WSL. Started on a root-owned folder as 99:100, the folder was handed over, node ran as uid 99 with no capabilities, the server answered and
docker stoptook under a second. A second start with the default PUID re-owned the folder to 1000,--user 1000:1000worked, and a non-numeric PUID stopped with a clear message.The new
dockerjob in CI repeats the main checks on every pull request, so a broken Dockerfile fails here rather than after a tag.npm run lintandnpm testpass.Before the next release
DOCKERHUB_TOKENneeds Read, Write & Delete scope for the Docker Hub page update. With the current Read & Write token the images still publish; only that last job fails.