Dockerfile.arm64 2.5 KB

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