Dockerfile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # DESIGNED FOR BUILDING ON AMD64 ONLY
  2. #####################################
  3. # Requires binfm_misc registration
  4. # https://github.com/multiarch/qemu-user-static#binfmt_misc-register
  5. ARG DOTNET_VERSION=7.0
  6. FROM node:lts-alpine as web-builder
  7. ARG JELLYFIN_WEB_VERSION=master
  8. RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 \
  9. && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
  10. && cd jellyfin-web-* \
  11. && npm ci --no-audit --unsafe-perm \
  12. && npm run build:production \
  13. && mv dist /dist
  14. FROM debian:stable-slim as app
  15. # https://askubuntu.com/questions/972516/debian-frontend-environment-variable
  16. ARG DEBIAN_FRONTEND="noninteractive"
  17. # http://stackoverflow.com/questions/48162574/ddg#49462622
  18. ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
  19. # https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
  20. ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
  21. # https://github.com/intel/compute-runtime/releases
  22. ARG GMMLIB_VERSION=22.0.2
  23. ARG IGC_VERSION=1.0.10395
  24. ARG NEO_VERSION=22.08.22549
  25. ARG LEVEL_ZERO_VERSION=1.3.22549
  26. # Install dependencies:
  27. # mesa-va-drivers: needed for AMD VAAPI. Mesa >= 20.1 is required for HEVC transcoding.
  28. # curl: healthcheck
  29. RUN apt-get update \
  30. && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg wget curl \
  31. && wget -O - https://repo.jellyfin.org/jellyfin_team.gpg.key | apt-key add - \
  32. && echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | tee /etc/apt/sources.list.d/jellyfin.list \
  33. && apt-get update \
  34. && apt-get install --no-install-recommends --no-install-suggests -y \
  35. mesa-va-drivers \
  36. jellyfin-ffmpeg5 \
  37. openssl \
  38. locales \
  39. # Intel VAAPI Tone mapping dependencies:
  40. # Prefer NEO to Beignet since the latter one doesn't support Comet Lake or newer for now.
  41. # Do not use the intel-opencl-icd package from repo since they will not build with RELEASE_WITH_REGKEYS enabled.
  42. && mkdir intel-compute-runtime \
  43. && cd intel-compute-runtime \
  44. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-gmmlib_${GMMLIB_VERSION}_amd64.deb \
  45. && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-core_${IGC_VERSION}_amd64.deb \
  46. && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-opencl_${IGC_VERSION}_amd64.deb \
  47. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-opencl-icd_${NEO_VERSION}_amd64.deb \
  48. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-level-zero-gpu_${LEVEL_ZERO_VERSION}_amd64.deb \
  49. && dpkg -i *.deb \
  50. && cd .. \
  51. && rm -rf intel-compute-runtime \
  52. && apt-get remove gnupg wget -y \
  53. && apt-get clean autoclean -y \
  54. && apt-get autoremove -y \
  55. && rm -rf /var/lib/apt/lists/* \
  56. && mkdir -p /cache /config /media \
  57. && chmod 777 /cache /config /media \
  58. && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
  59. # ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  60. ENV LC_ALL en_US.UTF-8
  61. ENV LANG en_US.UTF-8
  62. ENV LANGUAGE en_US:en
  63. FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
  64. WORKDIR /repo
  65. COPY . .
  66. ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
  67. # because of changes in docker and systemd we need to not build in parallel at the moment
  68. # see https://success.docker.com/article/how-to-reserve-resource-temporarily-unavailable-errors-due-to-tasksmax-setting
  69. RUN dotnet publish Jellyfin.Server --disable-parallel --configuration Release --output="/jellyfin" --self-contained --runtime linux-x64 -p:DebugSymbols=false -p:DebugType=none
  70. FROM app
  71. ENV HEALTHCHECK_URL=http://localhost:8096/health
  72. COPY --from=builder /jellyfin /jellyfin
  73. COPY --from=web-builder /dist /jellyfin/jellyfin-web
  74. EXPOSE 8096
  75. VOLUME /cache /config
  76. ENTRYPOINT ["./jellyfin/jellyfin", \
  77. "--datadir", "/config", \
  78. "--cachedir", "/cache", \
  79. "--ffmpeg", "/usr/lib/jellyfin-ffmpeg/ffmpeg"]
  80. HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
  81. CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1