Add arm64 support and Update Plex Download URLs to latest API (#48)

Add arm64 support and Update Plex Download URLs to latest API
This commit is contained in:
Maxime Marmont 2020-04-07 16:33:24 +02:00 committed by GitHub
parent 0ce632c43f
commit 4d069dc465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 6 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
docker-compose.yml
test/

View File

@ -1,6 +1,9 @@
FROM ubuntu:16.04
ARG S6_OVERLAY_VERSION=v1.17.2.0
ARG S6_OVERLAY_VERSION=v1.22.1.0
ARG S6_OVERLAY_ARCH=amd64
ARG PLEX_BUILD=linux-x86_64
ARG PLEX_DISTRO=debian
ARG DEBIAN_FRONTEND="noninteractive"
ENV TERM="xterm" LANG="C.UTF-8" LC_ALL="C.UTF-8"
@ -18,8 +21,8 @@ RUN \
&& \
# Fetch and extract S6 overlay
curl -J -L -o /tmp/s6-overlay-amd64.tar.gz https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-amd64.tar.gz && \
tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && \
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 / && \
# Add user
useradd -U -d /config -s /bin/false plex && \

60
Dockerfile.arm64 Normal file
View File

@ -0,0 +1,60 @@
FROM ubuntu:16.04
ARG S6_OVERLAY_VERSION=v1.22.1.0
ARG S6_OVERLAY_ARCH=aarch64
ARG PLEX_BUILD=linux-aarch64
ARG PLEX_DISTRO=debian
ARG DEBIAN_FRONTEND="noninteractive"
ENV TERM="xterm" LANG="C.UTF-8" LC_ALL="C.UTF-8"
ENTRYPOINT ["/init"]
RUN \
# Update and get dependencies
apt-get update && \
apt-get install -y \
tzdata \
curl \
xmlstarlet \
uuid-runtime \
unrar \
&& \
# 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 / && \
# 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 3005/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
ARG URL=
COPY root/ /
RUN \
# Save version and install
/installBinary.sh
HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1

View File

@ -27,7 +27,7 @@ else
fi
# Read set version
versionToInstall="$(cat /version.txt)"
readVarFromConf "version" versionToInstall
if [ -z "${versionToInstall}" ]; then
echo "No version specified in install. Broken image"
exit 1

View File

@ -2,7 +2,10 @@
. /plex-common.sh
echo "${TAG}" > /version.txt
addVarToConf "version" "${TAG}"
addVarToConf "plex_build" "${PLEX_BUILD}"
addVarToConf "plex_distro" "${PLEX_DISTRO}"
if [ ! -z "${URL}" ]; then
echo "Attempting to install from URL: ${URL}"
installFromRawUrl "${URL}"

View File

@ -1,5 +1,25 @@
#!/bin/bash
CONT_CONF_FILE="/version.txt"
function addVarToConf {
local variable="$1"
local value="$2"
if [ ! -z "${variable}" ]; then
echo ${variable}=${value} >> ${CONT_CONF_FILE}
fi
}
function readVarFromConf {
local variable="$1"
declare -n value=$2
if [ ! -z "${variable}" ]; then
value="$(grep -w ${variable} ${CONT_CONF_FILE} | cut -d'=' -f2 | tail -n 1)"
else
value=NULL
fi
}
function getVersionInfo {
local version="$1"
local token="$2"
@ -19,7 +39,11 @@ function getVersionInfo {
channel=8
fi
local url="https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=${channel}&distro=ubuntu"
# Read container architecture info from file created when building Docker image
readVarFromConf "plex_build" plexBuild
readVarFromConf "plex_distro" plexDistro
local url="https://plex.tv/downloads/details/5?build=${plexBuild}&channel=${channel}&distro=${plexDistro}"
if [ ${tokenNeeded} -gt 0 ]; then
url="${url}&X-Plex-Token=${token}"
fi