From 83062cd84e233cb70a7b57ec9ce3ce05d428c621 Mon Sep 17 00:00:00 2001 From: Min Idzelis Date: Thu, 22 Jun 2023 18:30:35 +0000 Subject: [PATCH] Use single multi-arch Dockerfile --- Dockerfile | 26 +++++++++++++-- Dockerfile.arm64 | 78 -------------------------------------------- Dockerfile.armv7 | 78 -------------------------------------------- Dockerfile.i386 | 78 -------------------------------------------- dev/build.386.sh | 2 +- dev/build.amd64.sh | 2 +- dev/build.arm32v7.sh | 2 +- dev/build.arm64v8.sh | 2 +- dev/push.all.sh | 1 + 9 files changed, 28 insertions(+), 241 deletions(-) delete mode 100644 Dockerfile.arm64 delete mode 100644 Dockerfile.armv7 delete mode 100644 Dockerfile.i386 create mode 100755 dev/push.all.sh diff --git a/Dockerfile b/Dockerfile index 22c5ee4a..b2e1d5b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,34 @@ -FROM ubuntu:22.04 - +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 +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 && \ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 deleted file mode 100644 index 4eaf1bcc..00000000 --- a/Dockerfile.arm64 +++ /dev/null @@ -1,78 +0,0 @@ -FROM arm64v8/ubuntu:22.04 - -ARG S6_OVERLAY_VERSION=v3.1.5.0 -ARG S6_OVERLAY_ARCH=aarch64 -ARG PLEX_BUILD=linux-aarch64 -ARG PLEX_DISTRO=debian -ARG DEBIAN_FRONTEND="noninteractive" - -RUN \ -# Update and get dependencies - apt-get update && \ - apt-get install -y \ - tzdata \ - curl \ - xz-utils \ - xmlstarlet \ - uuid-runtime \ - unrar \ - cron \ - && \ - \ -# Fetch and extract S6 overlay - 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 && \ - usermod -G users plex && \ - \ -# Setup directories - mkdir -p \ - /config \ - /transcode \ - /data \ - && \ - \ -# Cleanup - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /tmp/* && \ - rm -rf /var/tmp/* - -EXPOSE 32400/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp -VOLUME /config /transcode - -ARG AUTOUPDATE=false -ARG TAG=beta -ARG URL= - -ENV TAG=${TAG} \ - CHANGE_CONFIG_DIR_OWNERSHIP="true" \ - HOME="/config" \ - TZ="UTC" \ - \ - 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 - -HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1 - -ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/Dockerfile.armv7 b/Dockerfile.armv7 deleted file mode 100644 index a0e45875..00000000 --- a/Dockerfile.armv7 +++ /dev/null @@ -1,78 +0,0 @@ -FROM arm32v7/ubuntu:22.04 - -ARG S6_OVERLAY_VERSION=v3.1.5.0 -ARG S6_OVERLAY_ARCH=arm -ARG PLEX_BUILD=linux-armv7hf_neon -ARG PLEX_DISTRO=debian -ARG DEBIAN_FRONTEND="noninteractive" - -RUN \ -# Update and get dependencies - apt-get update && \ - apt-get install -y \ - tzdata \ - curl \ - xz-utils \ - xmlstarlet \ - uuid-runtime \ - unrar \ - cron \ - && \ - \ -# Fetch and extract S6 overlay - 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 && \ - usermod -G users plex && \ - \ -# Setup directories - mkdir -p \ - /config \ - /transcode \ - /data \ - && \ - \ -# Cleanup - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /tmp/* && \ - rm -rf /var/tmp/* - -EXPOSE 32400/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp -VOLUME /config /transcode - -ARG AUTOUPDATE=false -ARG TAG=beta -ARG URL= - -ENV TAG=${TAG} \ - CHANGE_CONFIG_DIR_OWNERSHIP="true" \ - HOME="/config" \ - TZ="UTC" \ - \ - 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 - -HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1 - -ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/Dockerfile.i386 b/Dockerfile.i386 deleted file mode 100644 index 591dc1ae..00000000 --- a/Dockerfile.i386 +++ /dev/null @@ -1,78 +0,0 @@ -FROM i386/ubuntu:18.04 - -ARG S6_OVERLAY_VERSION=v3.1.5.0 -ARG S6_OVERLAY_ARCH=i686 -ARG PLEX_BUILD=linux-x86 -ARG PLEX_DISTRO=debian -ARG DEBIAN_FRONTEND="noninteractive" - -RUN \ -# Update and get dependencies - apt-get update && \ - apt-get install -y \ - tzdata \ - curl \ - xz-utils \ - xmlstarlet \ - uuid-runtime \ - unrar \ - cron \ - && \ - \ -# Fetch and extract S6 overlay - 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 && \ - usermod -G users plex && \ - \ -# Setup directories - mkdir -p \ - /config \ - /transcode \ - /data \ - && \ - \ -# Cleanup - apt-get -y autoremove && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /tmp/* && \ - rm -rf /var/tmp/* - -EXPOSE 32400/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp -VOLUME /config /transcode - -ARG AUTOUPDATE=false -ARG TAG=beta -ARG URL= - -ENV TAG=${TAG} \ - CHANGE_CONFIG_DIR_OWNERSHIP="true" \ - HOME="/config" \ - TZ="UTC" \ - \ - 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 - -HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1 - -ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/dev/build.386.sh b/dev/build.386.sh index 23274d12..ef369777 100755 --- a/dev/build.386.sh +++ b/dev/build.386.sh @@ -4,4 +4,4 @@ IFS=$'\n\t' # This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once -docker buildx build -o type=docker,name=pms-386 --load --platform linux/386 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile.i386 .. +docker buildx build --progress=plain -o type=docker,name=pms-386 --load --platform linux/386 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile .. diff --git a/dev/build.amd64.sh b/dev/build.amd64.sh index 73775ebc..819f87d7 100755 --- a/dev/build.amd64.sh +++ b/dev/build.amd64.sh @@ -5,4 +5,4 @@ IFS=$'\n\t' # This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once # https://github.com/tianon/docker-brew-ubuntu-core/issues/183 explains why need to use --security-opt seccomp:unconfined -docker buildx build --security-opt seccomp:unconfined -o type=docker,name=pms-amd64 --platform linux/amd64 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile .. +docker buildx build --progress=plain --security-opt seccomp:unconfined -o type=docker,name=pms-amd64 --platform linux/amd64 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile .. diff --git a/dev/build.arm32v7.sh b/dev/build.arm32v7.sh index 8b7b2363..ae475da5 100755 --- a/dev/build.arm32v7.sh +++ b/dev/build.arm32v7.sh @@ -5,4 +5,4 @@ IFS=$'\n\t' # This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once # https://github.com/tianon/docker-brew-ubuntu-core/issues/183 explains why need to use --security-opt seccomp:unconfined -docker buildx build --security-opt seccomp:unconfined -o type=docker,name=pms-armv7 --load --platform linux/arm/v7 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile.armv7 .. +docker buildx build --progress=plain --security-opt seccomp:unconfined -o type=docker,name=pms-armv7 --load --platform linux/arm/v7 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile .. diff --git a/dev/build.arm64v8.sh b/dev/build.arm64v8.sh index 8cb69ffa..5ca14c16 100755 --- a/dev/build.arm64v8.sh +++ b/dev/build.arm64v8.sh @@ -5,4 +5,4 @@ IFS=$'\n\t' # This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once # https://github.com/tianon/docker-brew-ubuntu-core/issues/183 -docker buildx build --security-opt seccomp:unconfined -o type=docker,name=pms-arm64 --load --platform linux/arm64 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile.arm64 .. +docker buildx build --progress=plain --security-opt seccomp:unconfined -o type=docker,name=pms-arm64 --load --platform linux/arm64 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile .. diff --git a/dev/push.all.sh b/dev/push.all.sh new file mode 100755 index 00000000..2c764186 --- /dev/null +++ b/dev/push.all.sh @@ -0,0 +1 @@ +docker buildx build --progress=plain --push --security-opt seccomp:unconfined --platform linux/amd64,linux/386,linux/arm/v7,linux/arm64 --build-arg AUTOUPDATE=TRUE -f ../Dockerfile --tag INSERT_TAG_HERE:autoupdate ..