2024-02-11 12:47:51 -05:00
# Docker build arguments
2025-09-26 22:16:40 -04:00
ARG DOTNET_VERSION = 8 .0
ARG NODEJS_VERSION = 20
2024-02-11 12:47:51 -05:00
# Combined image version (Debian)
2025-09-27 13:06:11 +02:00
ARG OS_VERSION = trixie
2024-02-11 12:47:51 -05:00
# Jellyfin FFMPEG package
2024-09-09 23:15:39 +08:00
ARG FFMPEG_PACKAGE = jellyfin-ffmpeg7
2024-02-11 12:47:51 -05:00
# https://github.com/intel/compute-runtime/releases
2025-09-27 07:43:11 +02:00
ARG GMMLIB_VER = 22 .8.1
2024-12-24 22:25:46 +08:00
# >= Gen12 graphics (current)
2025-09-27 07:43:11 +02:00
ARG IGC2_VER = 2 .18.5
ARG IGC2_BUILD = 19820
ARG NEO_VER = 25 .35.35096.9
2024-12-24 22:25:46 +08:00
# <= Gen11 graphics (legacy)
2025-08-23 09:00:10 +08:00
ARG IGC1_LEGACY_VER = 1 .0.17537.24
ARG NEO_LEGACY_VER = 24 .35.30872.36
2024-02-11 12:47:51 -05:00
2024-02-24 22:10:18 +01:00
# https://github.com/tsukumijima/libmali-rockchip
ARG MALI_PKG_VER = 1 .9-1_arm64
2025-04-26 15:42:49 +00:00
ARG MALI_PKG_TAG = v1.9-1-2131373
ARG MALI_PKG_CFG = valhall-g610-g24p0-gbm
2024-02-24 22:10:18 +01:00
2024-02-11 12:47:51 -05:00
# Debian architecture (amd64, arm64, armhf), set by build script
2024-02-15 01:23:51 -05:00
ARG PACKAGE_ARCH
2024-02-11 12:47:51 -05:00
# Dotnet architeture (x64, arm64, arm), set by build script
2024-02-15 01:23:51 -05:00
ARG DOTNET_ARCH
2024-11-13 13:17:22 +08:00
# Base Image architecture (amd64, arm64v8, arm32v7), set by build script
2024-02-15 01:23:51 -05:00
ARG IMAGE_ARCH
2024-11-13 13:17:22 +08:00
# Target platform architecture (amd64, arm64/v8, arm/v7), set by build script
ARG TARGET_ARCH
2024-02-11 12:47:51 -05:00
2024-02-16 01:14:03 -05:00
# Jellyfin version
ARG JELLYFIN_VERSION
2024-02-11 12:47:51 -05:00
#
# Build the web artifacts
#
2025-09-20 21:23:28 +08:00
FROM node:${NODEJS_VERSION}-alpine AS web
2024-02-11 12:47:51 -05:00
ARG SOURCE_DIR = /src
ARG ARTIFACT_DIR = /web
2024-02-16 01:14:03 -05:00
ARG JELLYFIN_VERSION
ENV JELLYFIN_VERSION = ${ JELLYFIN_VERSION }
2024-02-11 12:47:51 -05:00
RUN apk add \
2024-02-23 18:24:32 +01:00
autoconf \
g++ \
make \
libpng-dev \
gifsicle \
2024-02-23 18:39:40 +01:00
alpine-sdk \
2024-02-23 18:24:32 +01:00
automake \
libtool \
gcc \
musl-dev \
nasm \
2024-11-03 11:05:05 -05:00
python3 \
2024-11-21 14:21:43 -05:00
git \
&& git config --global --add safe.directory /jellyfin/jellyfin-web
2024-02-11 12:47:51 -05:00
WORKDIR ${SOURCE_DIR }
COPY jellyfin-web .
RUN npm ci --no-audit --unsafe-perm \
&& npm run build:production \
&& mv dist ${ ARTIFACT_DIR }
#
# Build the server artifacts
#
2025-09-27 13:06:11 +02:00
FROM --platform=linux/${TARGET_ARCH } ${ IMAGE_ARCH } /debian:${ OS_VERSION } -slim AS server
2024-02-11 12:47:51 -05:00
2024-02-15 01:23:51 -05:00
ARG DOTNET_ARCH
2025-09-27 13:06:11 +02:00
ARG DOTNET_VERSION
2024-02-11 12:47:51 -05:00
ARG SOURCE_DIR = /src
ARG ARTIFACT_DIR = /server
2025-04-15 13:18:16 -04:00
ARG CONFIG = Release
ENV CONFIG = ${ CONFIG }
2024-02-11 12:47:51 -05:00
WORKDIR ${SOURCE_DIR }
COPY jellyfin-server .
ENV DOTNET_CLI_TELEMETRY_OPTOUT = 1
2025-09-27 13:06:11 +02:00
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests --yes \
curl \
ca-certificates \
libicu76 \
&& curl -fsSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel ${ DOTNET_VERSION } --install-dir /usr/local/bin
2025-04-11 16:50:23 -04:00
RUN dotnet publish Jellyfin.Server --arch ${ DOTNET_ARCH } --configuration ${ CONFIG } \
2024-02-11 12:47:51 -05:00
--output= " ${ ARTIFACT_DIR } " --self-contained \
2025-03-03 21:29:25 -08:00
-p:DebugSymbols= false -p:DebugType= none
2024-02-11 12:47:51 -05:00
#
# Build the final combined image
#
2025-09-20 21:23:28 +08:00
FROM --platform=linux/${TARGET_ARCH } ${ IMAGE_ARCH } /debian:${ OS_VERSION } -slim AS combined
2024-02-11 12:47:51 -05:00
ARG OS_VERSION
ARG FFMPEG_PACKAGE
2024-12-24 22:25:46 +08:00
ARG GMMLIB_VER
ARG IGC2_VER
ARG IGC2_BUILD
ARG NEO_VER
ARG IGC1_LEGACY_VER
ARG NEO_LEGACY_VER
2024-02-11 12:47:51 -05:00
2024-02-24 22:10:18 +01:00
ARG MALI_PKG_VER
ARG MALI_PKG_TAG
ARG MALI_PKG_CFG
2024-02-15 01:23:51 -05:00
ARG PACKAGE_ARCH
2024-02-11 12:47:51 -05:00
# Set the health URL
ENV HEALTHCHECK_URL = http://localhost:8096/health
# Default environment variables for the Jellyfin invocation
2024-03-27 20:23:31 +08:00
ENV DEBIAN_FRONTEND = "noninteractive" \
2024-02-11 12:47:51 -05:00
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"
2024-04-24 14:05:11 -04:00
# required for fontconfig cache
ENV XDG_CACHE_HOME = ${ JELLYFIN_CACHE_DIR }
2024-02-11 12:47:51 -05:00
# 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"
# Install dependencies:
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests --yes \
2024-02-23 18:24:32 +01:00
ca-certificates \
gnupg \
curl \
2024-02-11 12:47:51 -05:00
&& curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key \
2025-09-27 13:06:11 +02:00
| gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg \
&& cat <<EOF > /etc/apt/sources.list.d/jellyfin.sources
Types: deb
URIs: https://repo.jellyfin.org/debian
Suites: ${ OS_VERSION }
Components: main
Architectures: ${ PACKAGE_ARCH }
Signed-By: /etc/apt/keyrings/jellyfin.gpg
EOF
RUN apt-get update \
2024-02-11 12:47:51 -05:00
&& apt-get install --no-install-recommends --no-install-suggests --yes \
2024-02-23 18:24:32 +01:00
${ FFMPEG_PACKAGE } \
openssl \
locales \
2025-09-27 13:06:11 +02:00
libicu76 \
2024-02-23 18:24:32 +01:00
libfontconfig1 \
libfreetype6 \
2025-06-12 18:54:01 +08:00
libjemalloc2 \
2024-02-11 12:47:51 -05:00
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen \
2024-02-23 18:39:40 +01:00
&& apt-get remove gnupg apt-transport-https --yes \
2024-02-11 12:47:51 -05:00
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
2024-12-24 22:25:46 +08:00
# Intel OpenCL Tone mapping dependencies:
2024-03-03 18:55:13 -05:00
RUN if test " ${ PACKAGE_ARCH } " = "amd64" ; then \
2024-02-11 12:47:51 -05:00
mkdir intel-compute-runtime \
2024-03-03 18:59:56 -05:00
&& cd intel-compute-runtime \
2024-12-24 22:25:46 +08:00
&& curl -LO https://github.com/intel/compute-runtime/releases/download/${ NEO_VER } /libigdgmm12_${ GMMLIB_VER } _amd64.deb \
-LO https://github.com/intel/intel-graphics-compiler/releases/download/v${ IGC2_VER } /intel-igc-core-2_${ IGC2_VER } +${ IGC2_BUILD } _amd64.deb \
-LO https://github.com/intel/intel-graphics-compiler/releases/download/v${ IGC2_VER } /intel-igc-opencl-2_${ IGC2_VER } +${ IGC2_BUILD } _amd64.deb \
2025-09-27 13:06:11 +02:00
-LO https://github.com/intel/compute-runtime/releases/download/${ NEO_VER } /intel-opencl-icd_${ NEO_VER } -0_amd64.deb \
2024-12-24 22:25:46 +08:00
-LO https://github.com/intel/intel-graphics-compiler/releases/download/igc-${ IGC1_LEGACY_VER } /intel-igc-core_${ IGC1_LEGACY_VER } _amd64.deb \
-LO https://github.com/intel/intel-graphics-compiler/releases/download/igc-${ IGC1_LEGACY_VER } /intel-igc-opencl_${ IGC1_LEGACY_VER } _amd64.deb \
-LO https://github.com/intel/compute-runtime/releases/download/${ NEO_LEGACY_VER } /intel-opencl-icd-legacy1_${ NEO_LEGACY_VER } _amd64.deb \
2024-03-03 22:25:19 -05:00
&& apt-get install --no-install-recommends --no-install-suggests -f -y ./*.deb \
2024-03-03 18:59:56 -05:00
&& cd .. \
2024-02-11 12:47:51 -05:00
&& rm -rf intel-compute-runtime \
; fi \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
2024-02-24 22:10:18 +01:00
# Rockchip RK3588 libmali OpenCL dependencies:
2024-03-03 18:55:13 -05:00
RUN if test " ${ PACKAGE_ARCH } " = "arm64" ; then \
2024-02-24 22:10:18 +01:00
mkdir libmali-rockchip \
&& cd libmali-rockchip \
&& curl -LO https://github.com/tsukumijima/libmali-rockchip/releases/download/${ MALI_PKG_TAG } /libmali-${ MALI_PKG_CFG } _${ MALI_PKG_VER } .deb \
2024-03-03 22:25:19 -05:00
&& apt-get install --no-install-recommends --no-install-suggests -f -y ./*.deb \
2024-02-24 22:10:18 +01:00
&& cd .. \
&& rm -rf libmali-rockchip \
; fi \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
2025-06-12 20:36:30 +08:00
# Setup jemalloc: link the library to a path owned by us to handle arch specific library paths
2025-06-12 18:54:01 +08:00
RUN mkdir -p /usr/lib/jellyfin \
&& JEMALLOC_LINKED = 0 \
&& if [ " ${ PACKAGE_ARCH } " = "amd64" ] ; then \
if [ -f "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" ] ; then \
ln -s /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/lib/jellyfin/libjemalloc.so.2 && JEMALLOC_LINKED = 1; \
fi ; \
elif [ " ${ PACKAGE_ARCH } " = "arm64" ] ; then \
if [ -f "/usr/lib/aarch64-linux-gnu/libjemalloc.so.2" ] ; then \
ln -s /usr/lib/aarch64-linux-gnu/libjemalloc.so.2 /usr/lib/jellyfin/libjemalloc.so.2 && JEMALLOC_LINKED = 1; \
fi ; \
fi \
&& if [ " $JEMALLOC_LINKED " -eq 1 ] ; then \
echo " jemalloc library linked successfully for ${ PACKAGE_ARCH } . " ; \
else \
echo " WARNING: jemalloc library .so file not found for PACKAGE_ARCH ${ PACKAGE_ARCH } . Either the arch is not supported or copy failed. LD_PRELOAD might not work as expected. " >& 2; \
fi
# Set LD_PRELOAD to use the linked jemalloc library
ENV LD_PRELOAD = /usr/lib/jellyfin/libjemalloc.so.2
2024-02-11 12:47:51 -05:00
RUN mkdir -p ${ JELLYFIN_DATA_DIR } ${ JELLYFIN_CACHE_DIR } \
&& chmod 777 ${ JELLYFIN_DATA_DIR } ${ JELLYFIN_CACHE_DIR }
COPY --from= server /server /jellyfin
COPY --from= web /web /jellyfin/jellyfin-web
2024-05-19 15:59:24 +02:00
ARG JELLYFIN_VERSION
2024-10-19 16:30:45 -04:00
LABEL "org.opencontainers.image.source" = "https://github.com/jellyfin/jellyfin-packaging"
2024-05-19 15:59:24 +02:00
LABEL "org.opencontainers.image.title" = "Jellyfin"
LABEL "org.opencontainers.image.description" = "The Free Software Media System"
LABEL "org.opencontainers.image.documentation" = "https://jellyfin.org/docs/"
LABEL "org.opencontainers.image.version" = " ${ JELLYFIN_VERSION } "
LABEL "org.opencontainers.image.url" = "https://jellyfin.org"
2024-02-11 12:47:51 -05:00
EXPOSE 8096
VOLUME ${JELLYFIN_DATA_DIR } ${ JELLYFIN_CACHE_DIR }
2024-06-20 15:55:04 -04:00
ENTRYPOINT [ "/jellyfin/jellyfin" ]
2024-02-11 12:47:51 -05:00
HEALTHCHECK --interval= 30s --timeout= 30s --start-period= 10s --retries= 3 \
2024-10-06 21:00:10 +02:00
CMD curl --noproxy 'localhost' -Lk -fsS " ${ HEALTHCHECK_URL } " || exit 1