Dockerfile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ARG DOTNET_VERSION=5.0
  2. FROM node:alpine as web-builder
  3. ARG JELLYFIN_WEB_VERSION=master
  4. RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 \
  5. && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
  6. && cd jellyfin-web-* \
  7. && yarn install \
  8. && mv dist /dist
  9. FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-buster-slim as builder
  10. WORKDIR /repo
  11. COPY . .
  12. ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
  13. # because of changes in docker and systemd we need to not build in parallel at the moment
  14. # see https://success.docker.com/article/how-to-reserve-resource-temporarily-unavailable-errors-due-to-tasksmax-setting
  15. RUN dotnet publish Jellyfin.Server --disable-parallel --configuration Release --output="/jellyfin" --self-contained --runtime linux-x64 "-p:DebugSymbols=false;DebugType=none"
  16. FROM debian:buster-slim
  17. # https://askubuntu.com/questions/972516/debian-frontend-environment-variable
  18. ARG DEBIAN_FRONTEND="noninteractive"
  19. # http://stackoverflow.com/questions/48162574/ddg#49462622
  20. ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
  21. # https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
  22. ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
  23. COPY --from=builder /jellyfin /jellyfin
  24. COPY --from=web-builder /dist /jellyfin/jellyfin-web
  25. # https://github.com/intel/compute-runtime/releases
  26. ARG GMMLIB_VERSION=20.3.2
  27. ARG IGC_VERSION=1.0.5435
  28. ARG NEO_VERSION=20.46.18421
  29. ARG LEVEL_ZERO_VERSION=1.0.18421
  30. # Install dependencies:
  31. # mesa-va-drivers: needed for AMD VAAPI. Mesa >= 20.1 is required for HEVC transcoding.
  32. RUN apt-get update \
  33. && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg wget apt-transport-https \
  34. && wget -O - https://repo.jellyfin.org/jellyfin_team.gpg.key | apt-key add - \
  35. && 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 \
  36. && apt-get update \
  37. && apt-get install --no-install-recommends --no-install-suggests -y \
  38. mesa-va-drivers \
  39. jellyfin-ffmpeg \
  40. openssl \
  41. locales \
  42. # Intel VAAPI Tone mapping dependencies:
  43. # Prefer NEO to Beignet since the latter one doesn't support Comet Lake or newer for now.
  44. # Do not use the intel-opencl-icd package from repo since they will not build with RELEASE_WITH_REGKEYS enabled.
  45. && mkdir intel-compute-runtime \
  46. && cd intel-compute-runtime \
  47. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-gmmlib_${GMMLIB_VERSION}_amd64.deb \
  48. && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-core_${IGC_VERSION}_amd64.deb \
  49. && wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-${IGC_VERSION}/intel-igc-opencl_${IGC_VERSION}_amd64.deb \
  50. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-opencl_${NEO_VERSION}_amd64.deb \
  51. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-ocloc_${NEO_VERSION}_amd64.deb \
  52. && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/intel-level-zero-gpu_${LEVEL_ZERO_VERSION}_amd64.deb \
  53. && dpkg -i *.deb \
  54. && cd .. \
  55. && rm -rf intel-compute-runtime \
  56. && apt-get remove gnupg wget apt-transport-https -y \
  57. && apt-get clean autoclean -y \
  58. && apt-get autoremove -y \
  59. && rm -rf /var/lib/apt/lists/* \
  60. && mkdir -p /cache /config /media \
  61. && chmod 777 /cache /config /media \
  62. && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
  63. ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  64. ENV LC_ALL en_US.UTF-8
  65. ENV LANG en_US.UTF-8
  66. ENV LANGUAGE en_US:en
  67. EXPOSE 8096
  68. VOLUME /cache /config /media
  69. ENTRYPOINT ["./jellyfin/jellyfin", \
  70. "--datadir", "/config", \
  71. "--cachedir", "/cache", \
  72. "--ffmpeg", "/usr/lib/jellyfin-ffmpeg/ffmpeg"]