Skip to content

Commit

Permalink
Add arm64 support and Update Plex Download URLs to latest API (#48)
Browse files Browse the repository at this point in the history
Add arm64 support and Update Plex Download URLs to latest API
  • Loading branch information
maxlabuche authored Apr 7, 2020
1 parent 0ce632c commit 4d069dc
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
docker-compose.yml

test/
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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 && \
Expand Down
60 changes: 60 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion root/etc/cont-init.d/50-plex-update
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion root/installBinary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
26 changes: 25 additions & 1 deletion root/plex-common.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 4d069dc

Please sign in to comment.