Dockerfile.arm 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # DESIGNED FOR BUILDING ON ARM 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 multiarch/qemu-user-static:x86_64-arm as qemu
  15. FROM arm32v7/debian:stable-slim as app
  16. # https://askubuntu.com/questions/972516/debian-frontend-environment-variable
  17. ARG DEBIAN_FRONTEND="noninteractive"
  18. # http://stackoverflow.com/questions/48162574/ddg#49462622
  19. ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
  20. # https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
  21. ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
  22. COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
  23. # curl: setup & healthcheck
  24. RUN apt-get update \
  25. && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl && \
  26. curl -ks https://repo.jellyfin.org/debian/jellyfin_team.gpg.key | apt-key add - && \
  27. curl -ks https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0x6587ffd6536b8826e88a62547876ae518cbcf2f2 | apt-key add - && \
  28. echo 'deb [arch=armhf] https://repo.jellyfin.org/debian buster main' > /etc/apt/sources.list.d/jellyfin.list && \
  29. echo "deb http://ppa.launchpad.net/ubuntu-raspi2/ppa/ubuntu bionic main">> /etc/apt/sources.list.d/raspbins.list && \
  30. apt-get update && \
  31. apt-get install --no-install-recommends --no-install-suggests -y \
  32. jellyfin-ffmpeg \
  33. libssl-dev \
  34. libfontconfig1 \
  35. libfreetype6 \
  36. vainfo \
  37. libva2 \
  38. locales \
  39. && apt-get remove gnupg -y \
  40. && apt-get clean autoclean -y \
  41. && apt-get autoremove -y \
  42. && rm -rf /var/lib/apt/lists/* \
  43. && mkdir -p /cache /config /media \
  44. && chmod 777 /cache /config /media \
  45. && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
  46. # ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  47. ENV LC_ALL en_US.UTF-8
  48. ENV LANG en_US.UTF-8
  49. ENV LANGUAGE en_US:en
  50. FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
  51. WORKDIR /repo
  52. COPY . .
  53. ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
  54. # Discard objs - may cause failures if exists
  55. RUN find . -type d -name obj | xargs -r rm -r
  56. # Build
  57. RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm -p:DebugSymbols=false -p:DebugType=none
  58. FROM app
  59. ENV HEALTHCHECK_URL=http://localhost:8096/health
  60. COPY --from=builder /jellyfin /jellyfin
  61. COPY --from=web-builder /dist /jellyfin/jellyfin-web
  62. EXPOSE 8096
  63. VOLUME /cache /config
  64. ENTRYPOINT ["./jellyfin/jellyfin", \
  65. "--datadir", "/config", \
  66. "--cachedir", "/cache", \
  67. "--ffmpeg", "/usr/lib/jellyfin-ffmpeg/ffmpeg"]
  68. HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
  69. CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1