Dockerfile 4.0 KB

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