-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Autoupdate" feature. Update S6. Shellcheck. #81
base: master
Are you sure you want to change the base?
Changes from 14 commits
156169f
a09c55b
63c3c8c
b0ae80d
d504440
c5f4f70
c5da1c4
83062cd
502203f
42fdfc9
709a6de
e2734a5
c2fad2c
2cae64a
fcd1c43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,54 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG S6_OVERLAY_VERSION=v2.2.0.3 | ||
ARG S6_OVERLAY_ARCH=amd64 | ||
FROM ubuntu:22.04 as base-amd64 | ||
ARG S6_OVERLAY_VERSION=v3.1.5.0 | ||
ARG S6_OVERLAY_ARCH=x86_64 | ||
ARG PLEX_BUILD=linux-x86_64 | ||
ARG PLEX_DISTRO=debian | ||
ARG DEBIAN_FRONTEND="noninteractive" | ||
ARG INTEL_NEO_VERSION=20.48.18558 | ||
ARG INTEL_IGC_VERSION=1.0.5699 | ||
ARG INTEL_GMMLIB_VERSION=20.3.2 | ||
ENV TERM="xterm" LANG="C.UTF-8" LC_ALL="C.UTF-8" | ||
|
||
ENTRYPOINT ["/init"] | ||
FROM arm64v8/ubuntu:22.04 as base-arm64 | ||
ARG S6_OVERLAY_VERSION=v3.1.5.0 | ||
ARG S6_OVERLAY_ARCH=aarch64 | ||
ARG PLEX_BUILD=linux-aarch64 | ||
|
||
FROM arm32v7/ubuntu:22.04 as base-arm | ||
ARG S6_OVERLAY_VERSION=v3.1.5.0 | ||
ARG S6_OVERLAY_ARCH=arm | ||
ARG PLEX_BUILD=linux-armv7hf_neon | ||
|
||
FROM i386/ubuntu:18.04 as base-386 | ||
ARG S6_OVERLAY_VERSION=v3.1.5.0 | ||
ARG S6_OVERLAY_ARCH=i686 | ||
ARG PLEX_BUILD=linux-x86 | ||
|
||
FROM base-${TARGETARCH} AS plex | ||
ARG TARGETARCH | ||
RUN echo Building pms-docker for ${TARGETARCH} | ||
|
||
ARG DEBIAN_FRONTEND="noninteractive" | ||
ARG PLEX_DISTRO=debian | ||
|
||
RUN \ | ||
# Update and get dependencies | ||
apt-get update && \ | ||
apt-get install -y \ | ||
tzdata \ | ||
curl \ | ||
xz-utils \ | ||
xmlstarlet \ | ||
uuid-runtime \ | ||
unrar \ | ||
cron \ | ||
multitail \ | ||
&& \ | ||
\ | ||
# Fetch and extract S6 overlay | ||
curl -J -L -o /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz && \ | ||
tar xzf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz -C / --exclude='./bin' && \ | ||
tar xzf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz -C /usr ./bin && \ | ||
curl -L -s \ | ||
"https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" | tar Jxpf - -C / \ | ||
&& \ | ||
curl -L -s \ | ||
"https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz" | tar Jxpf - -C / \ | ||
&& \ | ||
\ | ||
# Add user | ||
useradd -U -d /config -s /bin/false plex && \ | ||
|
@@ -49,16 +71,35 @@ RUN \ | |
EXPOSE 32400/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp | ||
VOLUME /config /transcode | ||
|
||
ENV CHANGE_CONFIG_DIR_OWNERSHIP="true" \ | ||
HOME="/config" | ||
|
||
ARG TAG=beta | ||
# TAG can be "autoupdate" or an explicit version, like 1.32.4.7195-7c8f9d3b6 | ||
ARG TAG="autoupdate" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not certain about making the auto update the default behavior. It is antithetical to docker but then so is the current default of beta so 🤷 . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I made this comment, I didn't realize that your work is effectively supplanting the public and beta tags. So, assuming that I have that correct, then this change isn't really a change. |
||
ARG URL= | ||
ARG DEBUG= | ||
|
||
ENV CHANGE_CONFIG_DIR_OWNERSHIP="true" \ | ||
HOME="/config" \ | ||
# Note, only used for images built with TAG=autoupdate | ||
AUTO_UPDATE_CHANNEL="beta" \ | ||
\ | ||
TERM="xterm" \ | ||
LANG="C.UTF-8" \ | ||
LC_ALL="C.UTF-8" \ | ||
\ | ||
S6_KEEP_ENV=1 \ | ||
S6_SERVICES_GRACETIME=10000 \ | ||
S6_KILL_GRACETIME=5000 \ | ||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ | ||
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 | ||
|
||
COPY root/ / | ||
|
||
RUN \ | ||
# Save version and install | ||
/installBinary.sh | ||
/installBinary.sh \ | ||
&& \ | ||
# Clean up installer | ||
rm /installBinary.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this intended to cleanup a deb file instead of removing the script to install debs? |
||
|
||
HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1 | ||
|
||
ENTRYPOINT ["/init"] |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Dev Helper Scripts | ||
|
||
Hey homelab enthusiast! | ||
|
||
Unless you are enhancing these Dockerfile themselves, please ignore all the files here. In fact, your environment may be very different and these scripts may not work at all. These are just provided only as a reference/starting point so you don't have to start from scratch. | ||
|
||
You might just consider extending the images here. i.e. | ||
|
||
``` | ||
FROM plexinc/pms-docker:latest | ||
|
||
RUN echo "Add your modifications here" | ||
``` | ||
|
||
Otherwise, `dev.sh` will build all of the multi-platform docker images, for each platform it will build one that uses a specific version, and `autoupdate` version that doesn't bake the binary into the image, but rather downloads when container boots. Look inside the script for more info. | ||
|
||
`docker-bake.hcl` is a buildx bake file that will build all platforms, using pre-installed binaries and `update` versions. This bake file will push to dockerhub. You can override the destination using the `dockerhub_image` variable in `dev.sh`. | ||
|
||
|
||
### Examples | ||
|
||
#### Prereqs: | ||
- [docker](https://docs.docker.com/engine/install/) | ||
- [buildx](https://github.com/docker/buildx) | ||
- x86 based linux host | ||
|
||
```sh | ||
# sets up buildx for multi-arch builds | ||
./dev.sh setup | ||
|
||
# bake - build all and push to dockerhub | ||
./dev.sh bake | ||
|
||
# build version-specific and autoupdate image for amd64 | ||
./dev.sh build amd64 | ||
|
||
# build everything | ||
./dev.sh buildall | ||
|
||
# launches version-specific container | ||
./dev.sh debug amd64 | ||
|
||
# launches auto-update container | ||
./dev.sh debug amd64 autoupdate | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call this i386 to not change how this arch is spelled in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I can't really change this. The way this multi-arch Dockerfile works is that it pulls from various arch-specific ubuntu images and then names them using the pattern
base-TARGETARCH
where arch comes from the env varTARGETARCH
that is automatically set bydocker build[x]
. The actual selected image is selected on line 24 below.Looks like everyone has opinions, and they are not standardized, on what platforms mean what.
In the case of i386/ubuntu, this is meant to be used when TARGETARCH=386
S6-overlays' has its own opinions, and it maps TARGETARCH=386 to i686. See https://github.com/just-containers/s6-overlay#which-architecture-to-use-depending-on-your-targetarch
More details can be found here: https://github.com/BretFisher/multi-platform-docker-build/blob/main/README.md#the-problem-with-downloading-binaries-in-dockerfiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, the 32bit Ubuntu image is stuck at v18.04, which is way past EOL. Maybe this build should just be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18.04 only left support a month ago + a few days but that it still out of support and likely should still be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should stay until the team formally decides to stop supporting it.