Dockerfile.arm 3.1 KB

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