mirror of
https://github.com/spritsail/plex-media-server.git
synced 2024-11-05 01:16:23 +00:00
Build multiarch amd64/arm64 Plex images
Signed-off-by: Adam Dodman <adam@adam-ant.co.uk> Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
parent
d34d9d2fcc
commit
4579290641
128
.drone.star
Normal file
128
.drone.star
Normal file
@ -0,0 +1,128 @@
|
||||
repo = "spritsail/plex-media-server"
|
||||
architectures = ["amd64", "arm64"]
|
||||
publish_branches = ["master", "pass"]
|
||||
|
||||
def main(ctx):
|
||||
builds = []
|
||||
depends_on = []
|
||||
|
||||
for arch in architectures:
|
||||
key = "build-%s" % arch
|
||||
builds.append(step(arch, key))
|
||||
depends_on.append(key)
|
||||
|
||||
if ctx.build.branch in publish_branches:
|
||||
builds.append(publish(depends_on))
|
||||
builds.append(update_readme())
|
||||
|
||||
return builds
|
||||
|
||||
def step(arch, key):
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"name": key,
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
"arch": arch,
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"name": "build",
|
||||
"pull": "always",
|
||||
"image": "spritsail/docker-build",
|
||||
"settings": {
|
||||
"make": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "test-bin",
|
||||
"pull": "always",
|
||||
"image": "spritsail/docker-test",
|
||||
"settings": {
|
||||
"run": "busybox && curl --version && xmlstarlet --version"
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "test",
|
||||
"pull": "always",
|
||||
"image": "spritsail/docker-test",
|
||||
"settings": {
|
||||
"curl": ":32400/identity",
|
||||
"delay": 5,
|
||||
"pipe": "xmlstarlet sel -t -v \"/MediaContainer/@version\" | grep -qw \"$(label io.spritsail.version.plex | cut -d- -f1)\"",
|
||||
"retry": 10
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "publish",
|
||||
"pull": "always",
|
||||
"image": "spritsail/docker-publish",
|
||||
"settings": {
|
||||
"registry": {"from_secret": "registry_url"},
|
||||
"login": {"from_secret": "registry_login"},
|
||||
},
|
||||
"when": {
|
||||
"branch": publish_branches,
|
||||
"event": ["push"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
def publish(depends_on):
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"name": "publish-manifest",
|
||||
"depends_on": depends_on,
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"name": "publish",
|
||||
"image": "spritsail/docker-multiarch-publish",
|
||||
"pull": "always",
|
||||
"settings": {
|
||||
"tags": [
|
||||
"plexpass",
|
||||
"%label io.spritsail.version.plex | %prefix plexpass | %remsuf [0-9a-f]+$ | %auto 2"
|
||||
],
|
||||
"src_registry": {"from_secret": "registry_url"},
|
||||
"src_login": {"from_secret": "registry_login"},
|
||||
"dest_repo": repo,
|
||||
"dest_login": {"from_secret": "docker_login"},
|
||||
},
|
||||
"when": {
|
||||
"branch": publish_branches,
|
||||
"event": ["push"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
def update_readme():
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"name": "update-readme",
|
||||
"depends_on": [
|
||||
"publish-manifest",
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"name": "dockerhub-readme",
|
||||
"pull": "always",
|
||||
"image": "jlesage/drone-push-readme",
|
||||
"settings": {
|
||||
"repo": repo,
|
||||
"username": {"from_secret": "docker_username"},
|
||||
"password": {"from_secret": "docker_password"},
|
||||
},
|
||||
"when": {
|
||||
"branch": publish_branches,
|
||||
"event": ["push"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
# vim: ft=python sw=2
|
54
.drone.yml
54
.drone.yml
@ -1,54 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: build-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
pull: always
|
||||
image: spritsail/docker-build
|
||||
settings:
|
||||
make: true
|
||||
|
||||
- name: test-bin
|
||||
pull: always
|
||||
image: spritsail/docker-test
|
||||
settings:
|
||||
run: |
|
||||
busybox && \
|
||||
curl --version && \
|
||||
xmlstarlet --version
|
||||
|
||||
- name: test
|
||||
pull: always
|
||||
image: spritsail/docker-test
|
||||
settings:
|
||||
curl: :32400/identity
|
||||
delay: 5
|
||||
pipe: |
|
||||
xmlstarlet sel -t -v "/MediaContainer/@version" |
|
||||
grep -qw "$(label io.spritsail.version.plex | cut -d- -f1)"
|
||||
retry: 10
|
||||
|
||||
- name: publish
|
||||
pull: always
|
||||
image: spritsail/docker-publish
|
||||
settings:
|
||||
repo: spritsail/plex-media-server
|
||||
tags:
|
||||
- plexpass
|
||||
- "%label io.spritsail.version.plex | %prefix plexpass | %remsuf [0-9a-f]+$ | %auto 2"
|
||||
login: {from_secret: docker_login}
|
||||
when:
|
||||
branch:
|
||||
- pass
|
||||
event:
|
||||
- push
|
||||
---
|
||||
kind: signature
|
||||
hmac: a6e529b62ed2ecf24b2c3125f7267c321d56ce16d1cd8178f96e0399dd3096bd
|
||||
|
||||
...
|
26
Dockerfile
26
Dockerfile
@ -1,6 +1,5 @@
|
||||
ARG PLEX_VER=1.27.1.5891-c29537f86
|
||||
ARG PLEX_SHA=e6361f4089683b1e560481251bec206e91232aeb
|
||||
ARG BUSYBOX_VER=1.34.1
|
||||
ARG BUSYBOX_VER=1.35.0
|
||||
ARG SU_EXEC_VER=0.4
|
||||
ARG TINI_VER=0.19.0
|
||||
ARG ZLIB_VER=1.2.12
|
||||
@ -18,7 +17,7 @@ ARG LDFLAGS="$CFLAGS -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FROM spritsail/alpine:3.15 AS builder
|
||||
FROM spritsail/alpine:3.16 AS builder
|
||||
|
||||
RUN apk add --no-cache \
|
||||
autoconf \
|
||||
@ -43,36 +42,39 @@ RUN apk add --no-cache \
|
||||
FROM builder AS plex
|
||||
|
||||
ARG PLEX_VER
|
||||
ARG PLEX_SHA
|
||||
ARG OUTPUT
|
||||
|
||||
WORKDIR $OUTPUT
|
||||
|
||||
# Fetch Plex and required libraries
|
||||
RUN curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server-new/${PLEX_VER}/debian/plexmediaserver_${PLEX_VER}_amd64.deb \
|
||||
&& echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \
|
||||
RUN if [ "$(uname -m)" = "aarch64" ]; then \
|
||||
ARCH=arm64; LIB_DIRS=lib/omx; \
|
||||
else \
|
||||
ARCH=amd64; LIB_DIRS=lib/dri; \
|
||||
fi \
|
||||
&& curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server-new/${PLEX_VER}/debian/plexmediaserver_${PLEX_VER}_${ARCH}.deb \
|
||||
&& dpkg-deb -x plexmediaserver.deb . \
|
||||
\
|
||||
&& rm -r \
|
||||
&& rm -rfv \
|
||||
etc/ usr/share/ \
|
||||
usr/lib/plexmediaserver/etc \
|
||||
plexmediaserver.deb \
|
||||
\
|
||||
&& cd usr/lib/plexmediaserver \
|
||||
&& rm \
|
||||
&& rm -v \
|
||||
lib/libcrypto.so* \
|
||||
lib/libcurl.so* \
|
||||
lib/libssl.so* \
|
||||
lib/libnghttp2.so* \
|
||||
lib/plexmediaserver.* \
|
||||
etc/ld-musl-x86_64.path \
|
||||
Resources/start.sh \
|
||||
\
|
||||
# Place shared libraries in usr/lib so they can be actually shared
|
||||
&& mv lib/*.so* lib/dri ../ \
|
||||
&& rmdir lib etc \
|
||||
&& mv lib/*.so* $LIB_DIRS ../ \
|
||||
&& rmdir lib \
|
||||
&& ln -sv ../ lib \
|
||||
# Replace hardlink with a symlink; these files are the same
|
||||
&& cd .. && ln -sfvn ld-musl-x86_64.so.1 libc.so
|
||||
&& cd .. && ln -sfvn "ld-musl-$(uname -m).so.1" libc.so
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -35,7 +35,7 @@ if su-exec -e [ ! -w "$CONFIG_DIR" ]; then
|
||||
2>&1 echo -e "${RED}#######################################################${RESET}"
|
||||
2>&1 echo
|
||||
|
||||
chown $SUID:$SGID "$CONFIG_DIR"
|
||||
chown "$SUID:$SGID" "$CONFIG_DIR"
|
||||
chmod o+rw "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
@ -44,11 +44,11 @@ export PREF_FILE="$CONFIG_DIR/Preferences.xml"
|
||||
|
||||
exec su-exec -e sh <<EOF
|
||||
|
||||
source plex-util.sh
|
||||
. plex-util.sh
|
||||
|
||||
# Generate a default configuration on first run, including some user-specified values
|
||||
if [ ! -e "\$PREF_FILE" ]; then
|
||||
source gen-config.sh
|
||||
. gen-config.sh
|
||||
fi
|
||||
|
||||
# Changes the log verbosity (Environment variable takes precedence on Plex Config)
|
||||
|
@ -2,10 +2,10 @@
|
||||
set -e
|
||||
|
||||
# Contains getPref/setPref and PREF_FILE vars
|
||||
source plex-util.sh
|
||||
. plex-util.sh
|
||||
|
||||
# Create a default config file allowing external access
|
||||
echo -e $'<?xml version="1.0" encoding="utf-8"?>\n<Preferences />' > "${PREF_FILE}"
|
||||
printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Preferences />" > "${PREF_FILE}"
|
||||
|
||||
# Enforced defaults. These can be changed manually afterwards.
|
||||
setPref "EnableIPv6" "1"
|
||||
@ -23,7 +23,7 @@ if [ -z "${serial}" ]; then
|
||||
fi
|
||||
clientId="$(getPref "ProcessedMachineIdentifier")"
|
||||
if [ -z "${clientId}" ]; then
|
||||
clientId="$(echo -n "${serial}- Plex Media Server" | sha1sum | cut -b 1-40)"
|
||||
clientId="$(printf %s "${serial}- Plex Media Server" | sha1sum | cut -b 1-40)"
|
||||
setPref "ProcessedMachineIdentifier" "${clientId}"
|
||||
fi
|
||||
|
||||
@ -31,6 +31,6 @@ fi
|
||||
# It can also be triggered manually at any time by running
|
||||
# $ claim-server.sh --load-client-id --save
|
||||
|
||||
test -n "${ADVERTISE_IP}" && setPref "customConnections" "${ADVERTISE_IP}"
|
||||
test -n "${ALLOWED_NETWORKS}" && setPref "allowedNetworks" "${ALLOWED_NETWORKS}"
|
||||
test -n "${DISABLE_REMOTE_SEC}" && setPref "disableRemoteSecurity" "1"
|
||||
if [ -n "${ADVERTISE_IP}" ]; then setPref "customConnections" "${ADVERTISE_IP}"; fi
|
||||
if [ -n "${ALLOWED_NETWORKS}" ]; then setPref "allowedNetworks" "${ALLOWED_NETWORKS}"; fi
|
||||
if [ -n "${DISABLE_REMOTE_SEC}" ]; then setPref "disableRemoteSecurity" "1"; fi
|
||||
|
@ -6,7 +6,7 @@ getPref() {
|
||||
}
|
||||
setPref() {
|
||||
count="$(xmlstarlet sel -t -v "count(/Preferences/@$1)" "${PREF_FILE}")"
|
||||
if [ $(($count + 0)) -gt 0 ]; then
|
||||
if [ $((count + 0)) -gt 0 ]; then
|
||||
xmlstarlet ed --inplace --update "/Preferences/@$1" -v "$2" "${PREF_FILE}" 2>/dev/null
|
||||
else
|
||||
xmlstarlet ed --inplace --insert "/Preferences" --type attr -n "$1" -v "$2" "${PREF_FILE}" 2>/dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user