From 539c21cb62e4929a0bc8d403bb6a443ee050506f Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 4 Feb 2024 02:20:12 -0500 Subject: Add Docker build dockerfiles --- docker/Dockerfile.amd64 | 73 +++++++++++++++++++++++++++++++++ docker/Dockerfile.arm64 | 51 +++++++++++++++++++++++ docker/Dockerfile.armhf | 51 +++++++++++++++++++++++ docker/Dockerfile.jellyfin-server.amd64 | 12 ++++++ docker/Dockerfile.jellyfin-server.arm64 | 12 ++++++ docker/Dockerfile.jellyfin-server.armhf | 12 ++++++ docker/Dockerfile.jellyfin-web.all | 11 +++++ 7 files changed, 222 insertions(+) create mode 100644 docker/Dockerfile.amd64 create mode 100644 docker/Dockerfile.arm64 create mode 100644 docker/Dockerfile.armhf create mode 100644 docker/Dockerfile.jellyfin-server.amd64 create mode 100644 docker/Dockerfile.jellyfin-server.arm64 create mode 100644 docker/Dockerfile.jellyfin-server.armhf create mode 100644 docker/Dockerfile.jellyfin-web.all (limited to 'docker') diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64 new file mode 100644 index 0000000..8ee4ef8 --- /dev/null +++ b/docker/Dockerfile.amd64 @@ -0,0 +1,73 @@ +# By default build for stable; unstable must set this explicitly +ARG TARGET_RELEASE=stable + +FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-amd64 as server +FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web +FROM debian:bullseye-slim + +ENV HEALTHCHECK_URL=http://localhost:8096/health + +# Default environment variables for the Jellyfin invocation +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US:en" \ + JELLYFIN_DATA_DIR="/config" \ + JELLYFIN_CACHE_DIR="/cache" \ + JELLYFIN_CONFIG_DIR="/config/config" \ + JELLYFIN_LOG_DIR="/config/log" \ + JELLYFIN_WEB_DIR="/jellyfin/jellyfin-web" \ + JELLYFIN_FFMPEG="/usr/lib/jellyfin-ffmpeg/ffmpeg" + +# https://github.com/dlemstra/Magick.NET/issues/707#issuecomment-785351620 +ENV MALLOC_TRIM_THRESHOLD_=131072 + +# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support) +ENV NVIDIA_VISIBLE_DEVICES="all" +ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" + +# https://github.com/intel/compute-runtime/releases +ARG GMMLIB_VERSION=22.3.0 +ARG IGC_VERSION=1.0.14828.8 +ARG NEO_VERSION=23.30.26918.9 +ARG LEVEL_ZERO_VERSION=1.3.26918.9 + +# Install dependencies: +# curl: healthcheck +RUN apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl wget apt-transport-https \ + && curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian-jellyfin.gpg \ + && echo 'deb [arch=amd64] https://repo.jellyfin.org/debian bullseye main' > /etc/apt/sources.list.d/jellyfin.list \ + && cat /etc/apt/sources.list.d/jellyfin.list \ + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y jellyfin-ffmpeg5 openssl locales libfontconfig1 libfreetype6 \ +# Intel VAAPI Tone mapping dependencies: +# Prefer NEO to Beignet since the latter one doesn't support Comet Lake or newer for now. +# Do not use the intel-opencl-icd package from repo since they will not build with RELEASE_WITH_REGKEYS enabled. + && mkdir intel-compute-runtime \ + && cd intel-compute-runtime \ + && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/libigdgmm12_${GMMLIB_VERSION}_amd64.deb \ + && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-core_${IGC_VERSION}_amd64.deb \ + && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-opencl_${IGC_VERSION}_amd64.deb \ + && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-opencl-icd_${NEO_VERSION}_amd64.deb \ + && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-level-zero-gpu_${LEVEL_ZERO_VERSION}_amd64.deb \ + && dpkg -i *.deb \ + && cd .. \ + && rm -rf intel-compute-runtime \ + && apt-get remove gnupg wget apt-transport-https -y \ + && apt-get clean autoclean -y \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && chmod 777 ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen + +COPY --from=server /jellyfin /jellyfin +COPY --from=web /jellyfin-web /jellyfin/jellyfin-web + +EXPOSE 8096 +VOLUME ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} +ENTRYPOINT [ "/jellyfin/jellyfin" ] + +HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ + CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1 diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 0000000..c297c35 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,51 @@ +# By default build for stable; unstable must set this explicitly +ARG TARGET_RELEASE=stable + +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-arm64 as server +FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web +FROM arm64v8/debian:bullseye-slim +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin + +ENV HEALTHCHECK_URL=http://localhost:8096/health + +# Default environment variables for the Jellyfin invocation +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US:en" \ + JELLYFIN_DATA_DIR="/config" \ + JELLYFIN_CACHE_DIR="/cache" \ + JELLYFIN_CONFIG_DIR="/config/config" \ + JELLYFIN_LOG_DIR="/config/log" \ + JELLYFIN_WEB_DIR="/jellyfin/jellyfin-web" \ + JELLYFIN_FFMPEG="/usr/lib/jellyfin-ffmpeg/ffmpeg" + +# https://github.com/dlemstra/Magick.NET/issues/707#issuecomment-785351620 +ENV MALLOC_TRIM_THRESHOLD_=131072 + +# Install dependencies: +# curl: healcheck +RUN apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl wget \ + && curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian-jellyfin.gpg \ + && echo 'deb [arch=arm64] https://repo.jellyfin.org/debian bullseye main' > /etc/apt/sources.list.d/jellyfin.list \ + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y jellyfin-ffmpeg5 openssl locales libfontconfig1 libfreetype6 \ + && apt-get remove gnupg wget -y \ + && apt-get clean autoclean -y \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && chmod 777 ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen + +COPY --from=server /jellyfin /jellyfin +COPY --from=web /jellyfin-web /jellyfin/jellyfin-web + +EXPOSE 8096 +VOLUME ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} +ENTRYPOINT [ "/jellyfin/jellyfin" ] + +HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ + CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1 diff --git a/docker/Dockerfile.armhf b/docker/Dockerfile.armhf new file mode 100644 index 0000000..490cd4a --- /dev/null +++ b/docker/Dockerfile.armhf @@ -0,0 +1,51 @@ +# By default build for stable; unstable must set this explicitly +ARG TARGET_RELEASE=stable + +FROM multiarch/qemu-user-static:x86_64-arm as qemu +FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-armhf as server +FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web +FROM arm32v7/debian:bullseye-slim +COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin + +ENV HEALTHCHECK_URL=http://localhost:8096/health + +# Default environment variables for the Jellyfin invocation +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US:en" \ + JELLYFIN_DATA_DIR="/config" \ + JELLYFIN_CACHE_DIR="/cache" \ + JELLYFIN_CONFIG_DIR="/config/config" \ + JELLYFIN_LOG_DIR="/config/log" \ + JELLYFIN_WEB_DIR="/jellyfin/jellyfin-web" \ + JELLYFIN_FFMPEG="/usr/lib/jellyfin-ffmpeg/ffmpeg" + +# https://github.com/dlemstra/Magick.NET/issues/707#issuecomment-785351620 +ENV MALLOC_TRIM_THRESHOLD_=131072 + +# Install dependencies: +# curl: healthcheck +RUN apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl wget \ + && curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian-jellyfin.gpg \ + && echo 'deb [arch=armhf] https://repo.jellyfin.org/debian bullseye main' > /etc/apt/sources.list.d/jellyfin.list \ + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y jellyfin-ffmpeg5 openssl locales libfontconfig1 libfreetype6 \ + && apt-get remove gnupg wget -y \ + && apt-get clean autoclean -y \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && chmod 777 ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} \ + && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen + +COPY --from=server /jellyfin /jellyfin +COPY --from=web /jellyfin-web /jellyfin/jellyfin-web + +EXPOSE 8096 +VOLUME ${JELLYFIN_DATA_DIR} ${JELLYFIN_CACHE_DIR} +ENTRYPOINT [ "/jellyfin/jellyfin" ] + +HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ + CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1 diff --git a/docker/Dockerfile.jellyfin-server.amd64 b/docker/Dockerfile.jellyfin-server.amd64 new file mode 100644 index 0000000..ca16a08 --- /dev/null +++ b/docker/Dockerfile.jellyfin-server.amd64 @@ -0,0 +1,12 @@ +ARG DOTNET_VERSION=8.0 + +FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-bookworm-slim + +ARG SOURCE_DIR=/src +ARG ARTIFACT_DIR=/jellyfin + +WORKDIR ${SOURCE_DIR} +COPY . . +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 + +RUN dotnet publish Jellyfin.Server --configuration Release --output="${ARTIFACT_DIR}" --self-contained --runtime linux-x64 -p:DebugSymbols=false -p:DebugType=none diff --git a/docker/Dockerfile.jellyfin-server.arm64 b/docker/Dockerfile.jellyfin-server.arm64 new file mode 100644 index 0000000..6e0f7d1 --- /dev/null +++ b/docker/Dockerfile.jellyfin-server.arm64 @@ -0,0 +1,12 @@ +ARG DOTNET_VERSION=8.0 + +FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-bookworm-slim + +ARG SOURCE_DIR=/src +ARG ARTIFACT_DIR=/jellyfin + +WORKDIR ${SOURCE_DIR} +COPY . . +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 + +RUN dotnet publish Jellyfin.Server --configuration Release --output="${ARTIFACT_DIR}" --self-contained --runtime linux-arm64 -p:DebugSymbols=false -p:DebugType=none diff --git a/docker/Dockerfile.jellyfin-server.armhf b/docker/Dockerfile.jellyfin-server.armhf new file mode 100644 index 0000000..44fb705 --- /dev/null +++ b/docker/Dockerfile.jellyfin-server.armhf @@ -0,0 +1,12 @@ +ARG DOTNET_VERSION=8.0 + +FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-bookworm-slim + +ARG SOURCE_DIR=/src +ARG ARTIFACT_DIR=/jellyfin + +WORKDIR ${SOURCE_DIR} +COPY . . +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 + +RUN dotnet publish Jellyfin.Server --configuration Release --output="${ARTIFACT_DIR}" --self-contained --runtime linux-arm -p:DebugSymbols=false -p:DebugType=none diff --git a/docker/Dockerfile.jellyfin-web.all b/docker/Dockerfile.jellyfin-web.all new file mode 100644 index 0000000..33cf501 --- /dev/null +++ b/docker/Dockerfile.jellyfin-web.all @@ -0,0 +1,11 @@ +FROM node:lts-alpine + +ARG SOURCE_DIR=/src +ARG ARTIFACT_DIR=/jellyfin-web + +RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 + +WORKDIR ${SOURCE_DIR} +COPY . . + +RUN npm ci --no-audit --unsafe-perm && mv dist ${ARTIFACT_DIR} -- cgit