Dockerfile.arm64 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # DESIGNED FOR BUILDING ON ARM64 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-aarch64 as qemu
  14. FROM arm64v8/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-aarch64-static /usr/bin
  22. # curl: healcheck
  23. RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
  24. ffmpeg \
  25. libssl-dev \
  26. ca-certificates \
  27. libfontconfig1 \
  28. libfreetype6 \
  29. libomxil-bellagio0 \
  30. libomxil-bellagio-bin \
  31. locales \
  32. curl \
  33. && apt-get clean autoclean -y \
  34. && apt-get autoremove -y \
  35. && rm -rf /var/lib/apt/lists/* \
  36. && mkdir -p /cache /config /media \
  37. && chmod 777 /cache /config /media \
  38. && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
  39. # ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  40. ENV LC_ALL en_US.UTF-8
  41. ENV LANG en_US.UTF-8
  42. ENV LANGUAGE en_US:en
  43. FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
  44. WORKDIR /repo
  45. COPY . .
  46. ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
  47. # Discard objs - may cause failures if exists
  48. RUN find . -type d -name obj | xargs -r rm -r
  49. # Build
  50. RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm64 -p:DebugSymbols=false -p:DebugType=none
  51. FROM app
  52. ENV HEALTHCHECK_URL=http://localhost:8096/health
  53. COPY --from=builder /jellyfin /jellyfin
  54. COPY --from=web-builder /dist /jellyfin/jellyfin-web
  55. EXPOSE 8096
  56. VOLUME /cache /config
  57. ENTRYPOINT ["./jellyfin/jellyfin", \
  58. "--datadir", "/config", \
  59. "--cachedir", "/cache", \
  60. "--ffmpeg", "/usr/bin/ffmpeg"]
  61. HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
  62. CMD curl -Lk -fsS "${HEALTHCHECK_URL}" || exit 1