Skip to content
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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dev Helper Scripts

Unless you are making changes to the Dockerfile themselves, please ignore all the files here.
7 changes: 7 additions & 0 deletions dev/build.386.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
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 -f ../Dockerfile.i386 ..
8 changes: 8 additions & 0 deletions dev/build.amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
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 -f ../Dockerfile ..
midzelis marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions dev/build.arm32v7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
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 -f ../Dockerfile.armv7 ..
8 changes: 8 additions & 0 deletions dev/build.arm64v8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
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 -f ../Dockerfile.arm64 ..
7 changes: 7 additions & 0 deletions dev/debug.386.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once

docker run --rm --name pms-386 --platform linux/386 -e DEBUG=true -it pms-386:latest bash
midzelis marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions dev/debug.amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once

docker run --rm --name pms-amd64 -e DEBUG=true -it pms-amd64:latest bash
midzelis marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions dev/debug.arm32v7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once

# Note - S6 overlay does NOT like it when you give it a tty under QEMU - do not run
# the container with "-it" rather, run it in background (so we get log output) then
# exec a bash process to enter the container.

trap "trap - SIGTERM && docker stop pms-armv7" SIGINT SIGTERM EXIT
docker run --rm --name pms-armv7 --platform linux/arm/v7 -e DEBUG=true pms-armv7:latest &
sleep 5
docker exec -it pms-armv7 bash
15 changes: 15 additions & 0 deletions dev/debug.arm64v8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# This is just a helper script to quickly test local Dockerfile builds, please run setup-build-env.sh once

# Note - S6 overlay does NOT like it when you give it a tty under QEMU - do not run
# the container with "-it" rather, run it in background (so we get log output) then
# exec a bash process to enter the container.

trap "trap - SIGTERM && docker stop pms-armv7" SIGINT SIGTERM EXIT
docker run --rm --name pms-arm64 --platform linux/arm64 -e DEBUG=true pms-arm64:latest &
sleep 5
docker exec -it pms-arm64 bash

16 changes: 16 additions & 0 deletions dev/setup-build-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

# This is a one time setup script to setup the build env needed by the build and debug scripts.
# Assumes this is running on Linux (any distro) using (intel/amd).

# Create a multi-arch buildx builder named PlexBuilder (if it doesn't exist)
if ! docker buildx inspect PlexBuilder 1> /dev/null 2>& 1; then
echo Creating PlexBuilder
# --use will make it automatically use this builder
docker buildx create --name PlexBuilder --platform linux/arm64,linux/arm/v7,linux/386 --use
# this is needed to register the arch-specific images with QEMU to be able to test
# these without native hardware
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi
16 changes: 16 additions & 0 deletions test-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# This is just a helper script to quickly test local Dockerfile builds

# build variations
#--build-arg AUTOUPDATE=false
#--build-arg URL=https://plex.tv//updater/packages/166139/file
#--build-arg TAG=public

ID=$(docker build --build-arg AUTOUPDATE=TRUE --build-arg TAG=beta . 2>&1 | tee /dev/fd/2 build.log | tail -1 | awk '{ print $3}')

# with persistent volume
docker run --rm -it -v testing-vol:/config:rw "$ID"
# without persistent volume
# docker run --rm -it -v "$ID" bash