aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2024-02-11 14:21:47 -0500
committerJoshua M. Boniface <joshua@boniface.me>2024-02-11 14:21:47 -0500
commit6144590fffb3d29f322dd06e85ebad6e2d7ab67c (patch)
treef1d0ca68ed9834429167f44a62941713aaab1c81
parentAdd combined docker builds and rework Deb builds (diff)
downloadjellyfin-packaging-6144590fffb3d29f322dd06e85ebad6e2d7ab67c.tar.gz
jellyfin-packaging-6144590fffb3d29f322dd06e85ebad6e2d7ab67c.tar.bz2
jellyfin-packaging-6144590fffb3d29f322dd06e85ebad6e2d7ab67c.zip
Add portable builds
-rwxr-xr-xbuild.py24
-rw-r--r--portable/Dockerfile56
-rwxr-xr-xportable/build.sh46
3 files changed, 123 insertions, 3 deletions
diff --git a/build.py b/build.py
index 78e67cb..74119a0 100755
--- a/build.py
+++ b/build.py
@@ -71,14 +71,29 @@ def build_package_deb(jvers, btype, barch, bvers):
# Build the dockerfile and packages
os.system(f"docker build --progress=plain --build-arg PTYPE={ostype} --build-arg PVERSION={osversion} --build-arg PARCH={PARCH} --build-arg GCC_VERSION={crossgccvers} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}")
- os.system(f"docker run --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out:/dist --name {imagename} {imagename}")
+ os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --name {imagename} {imagename}")
def build_package(jvers, btype, barch, bvers):
pass
-def build_docker(jvers, btype, barch, bvers):
+def build_portable(jvers, btype, _barch, _bvers):
+ # Set the dockerfile
+ dockerfile = configurations[btype]["dockerfile"]
+
+ # Use a unique docker image name for consistency
+ imagename = f"{configurations[btype]['imagename']}-{jvers}_{btype}"
+
+ # Set the archive type (tar-gz or zip)
+ archivetypes = f"{configurations[btype]['archivetypes']}"
+
+ # Build the dockerfile and packages
+ os.system(f"docker build --progress=plain --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}")
+ os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}")
+
+
+def build_docker(jvers, btype, _barch, _bvers):
print("> Building Docker images...")
print()
@@ -201,7 +216,10 @@ configurations = {
"def": build_package,
},
"portable": {
- "def": build_package,
+ "def": build_portable,
+ "dockerfile": "portable/Dockerfile",
+ "imagename": "jellyfin-builder",
+ "archivetypes": "tar,zip",
},
"docker": {
"def": build_docker,
diff --git a/portable/Dockerfile b/portable/Dockerfile
new file mode 100644
index 0000000..3f86299
--- /dev/null
+++ b/portable/Dockerfile
@@ -0,0 +1,56 @@
+# Docker build arguments
+ARG DOTNET_VERSION=8.0
+ARG NODEJS_VERSION=20
+
+ARG PTYPE=debian
+ARG PVERSION=12
+
+FROM ${PTYPE}:${PVERSION}
+
+ARG SOURCE_DIR=/jellyfin
+ARG ARTIFACT_DIR=/dist
+ARG DOTNET_VERSION
+ARG NODEJS_VERSION
+ARG PTYPE
+ARG PVERSION
+
+# Docker run environment
+ENV SOURCE_DIR=/jellyfin
+ENV ARTIFACT_DIR=/dist
+ENV TYPE=${PTYPE}
+ENV VERSION=${PVERSION}
+ENV ARCHIVE_TYPES=tar
+
+# Prepare Debian build environment
+RUN apt-get update -y \
+ && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \
+ apt-get install --no-install-recommends -y \
+ wget debhelper gnupg devscripts build-essential mmv lsb-release zip \
+ libssl*.* liblttng-ust* \
+ libfontconfig*-dev libcurl*openssl-dev libfreetype*-dev libssl-dev \
+ && apt-get clean autoclean -y \
+ && apt-get autoremove -y \
+ && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/*
+
+# Prepare dotnet SDK
+RUN wget https://packages.microsoft.com/config/${PTYPE}/${PVERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
+ && dpkg -i packages-microsoft-prod.deb \
+ && apt-get -f install \
+ && apt-get update \
+ && apt-get install -y dotnet-sdk-${DOTNET_VERSION}
+
+# Prepare nodejs
+RUN wget https://deb.nodesource.com/setup_${NODEJS_VERSION}.x -O nodejs-install.sh \
+ && chmod +x ./nodejs-install.sh \
+ && ./nodejs-install.sh \
+ && apt-get install -y \
+ nodejs
+
+# Link to build script
+RUN ln -sf ${SOURCE_DIR}/portable/build.sh /build.sh
+
+VOLUME ${SOURCE_DIR}/
+
+VOLUME ${ARTIFACT_DIR}/
+
+ENTRYPOINT ["/build.sh"]
diff --git a/portable/build.sh b/portable/build.sh
new file mode 100755
index 0000000..f8a3295
--- /dev/null
+++ b/portable/build.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#= Debian .deb builder
+
+set -o errexit
+set -o xtrace
+
+# Create the intermediate build dir
+BUILD_DIR="/build"
+mkdir -p ${BUILD_DIR}
+
+# Move to source directory
+pushd "${SOURCE_DIR}"
+
+# Build server
+pushd jellyfin-server
+dotnet publish Jellyfin.Server --configuration Release --output ${BUILD_DIR}/ -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=false
+popd
+
+# Build web
+pushd jellyfin-web
+npm ci --no-audit --unsafe-perm
+npm run build:production
+mv dist ${BUILD_DIR}/jellyfin-web
+popd
+
+mkdir -p "${ARTIFACT_DIR}/"
+
+pushd ${BUILD_DIR}
+for ARCHIVE_TYPE in $( tr ',' '\n' <<<"${ARCHIVE_TYPES}" ); do
+ case ${ARCHIVE_TYPE} in
+ tar)
+ tar -czf "${ARTIFACT_DIR}"/jellyfin_${JVERS}.tar.gz .
+ ;;
+ zip)
+ zip -qr "${ARTIFACT_DIR}"/jellyfin_${JVERS}.zip .
+ ;;
+ esac
+done
+popd
+
+# Clean up any lingering artifacts
+make -f debian/rules clean
+rm -rf ${BUILD_DIR}
+
+popd
bgstack15