"Autoupdate" feature. Update S6. Shellcheck.
I've always been annoyed that my containerized Plex server says that theres a new update. Its pretty annoying to have to pull a new docker image or to set up things like watchtower.
Instead, I modified the official pms-docker image to support autoupdates (optionally.) It's fully backwards compatible, and it should be buildable exactly the same way as before (however you did that.)
There's a new ARG 'autoupdate' default=false. If false, its 100% backwards compatible.
If its true, it will skip downloading the ARG TAG completely. Instead, it will download (and cache) the binary on startup. It will also install and run a cron job (randomized between 4am-4:30am) to check for updates. If it finds an update it will stop the server, install the update, and re-start the server.
I also updated S6 to latest version.
I also ran shellcheck and fixed all the warnings.
Oh, and also added sha256sum checking of all downloads.
Thanks. I split up the PR into much more bite-sized changes. Additionally, the image is available up on: https://hub.docker.com/r/midzelis/pms-docker/tags
Looking forward to your review/comments.
@gbooker @sztomi - is there anything more to do here?
This is very anti-pattern for containerised applications.
In any normal situation the root filesystem isn't (and shouldn't be) writable.
The exception I can think of is when Docker is used purely as an abstraction layer e.g. where Plex couldn't be installed natively, and instead one could mount a volume to the entire container filesystem, rather than just config files and a small bit of state.
In my setup (k3s) the autoupdate behaviour described would result in a startup loop that looks like restart > update > restart > update because the only persisted state is under /config.
There are as many ways to solve this particular issue as there are installations of it; I might suggest watchtower (as previously mentioned) is the most efficient and most appropriate one for a container environment, but as I said it's all subjective.
Should we close this @gbooker ?