Browse Source

Merge pull request #666 from nvllsvm/cross-platform

Add cross-platform build for arm64
Anthony Lavado 6 years ago
parent
commit
29f3330091
3 changed files with 41 additions and 4 deletions
  1. 2 0
      .dockerignore
  2. 6 4
      Dockerfile.arm
  3. 33 0
      Dockerfile.arm64

+ 2 - 0
.dockerignore

@@ -1,6 +1,8 @@
 .git
 .git
 .dockerignore
 .dockerignore
 Dockerfile
 Dockerfile
+Dockerfile.arm
+Dockerfile.arm64
 CONTRIBUTORS.md
 CONTRIBUTORS.md
 README.md
 README.md
 deployment/*/dist
 deployment/*/dist

+ 6 - 4
Dockerfile.arm

@@ -1,18 +1,20 @@
 ARG DOTNET_VERSION=3.0
 ARG DOTNET_VERSION=3.0
 
 
-FROM microsoft/dotnet:${DOTNET_VERSION}-sdk as builder
+
+FROM microsoft/dotnet:${DOTNET_VERSION}-sdk-stretch-arm32v7 as builder
 WORKDIR /repo
 WORKDIR /repo
 COPY . .
 COPY . .
 #TODO Remove or update the sed line when we update dotnet version.
 #TODO Remove or update the sed line when we update dotnet version.
 RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
 RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
- && find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
- && dotnet clean \
+ && dotnet clean -maxcpucount:1 \
  && dotnet publish \
  && dotnet publish \
+    -maxcpucount:1 \
     --configuration release \
     --configuration release \
     --output /jellyfin \
     --output /jellyfin \
     Jellyfin.Server
     Jellyfin.Server
 
 
-FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
+
+FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm32v7
 COPY --from=builder /jellyfin /jellyfin
 COPY --from=builder /jellyfin /jellyfin
 EXPOSE 8096
 EXPOSE 8096
 RUN apt-get update \
 RUN apt-get update \

+ 33 - 0
Dockerfile.arm64

@@ -0,0 +1,33 @@
+# Requires binfm_misc registration for aarch64
+# https://github.com/multiarch/qemu-user-static#binfmt_misc-register
+ARG DOTNET_VERSION=3.0
+
+
+FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
+FROM alpine as qemu_extract
+COPY --from=qemu /usr/bin qemu_user_static.tgz
+RUN tar -xzvf qemu_user_static.tgz
+
+
+FROM microsoft/dotnet:${DOTNET_VERSION}-sdk-stretch-arm64v8 as builder
+COPY --from=qemu_extract qemu-* /usr/bin
+WORKDIR /repo
+COPY . .
+#TODO Remove or update the sed line when we update dotnet version.
+RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
+ && find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
+ && dotnet clean \
+ && dotnet publish \
+    --configuration release \
+    --output /jellyfin \
+    Jellyfin.Server
+
+
+FROM microsoft/dotnet:${DOTNET_VERSION}-runtime-stretch-slim-arm64v8
+COPY --from=qemu_extract qemu-* /usr/bin
+COPY --from=builder /jellyfin /jellyfin
+EXPOSE 8096
+RUN apt-get update \
+ && apt-get install -y ffmpeg
+VOLUME /config /media
+ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config