From 69b39c694037b2030b5e9f92caffad8be1133f69 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Mon, 2 May 2022 22:10:50 -0500 Subject: [PATCH] try building arm64 docker image --- .github/workflows/docker.yml | 27 ++++++++++++++++++++ docker/arm64/Dockerfile | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 docker/arm64/Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9d2c2a5bb..fd303a7df 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -30,18 +30,29 @@ jobs: - name: base path: '' suffix: '' + qemu: false - name: nvidia path: 'nvidia/' suffix: '-nvidia' + qemu: false - name: vaapi path: 'vaapi/' suffix: '-vaapi' + qemu: false + - name: arm64 + path: 'arm64/' + suffix: '-arm64' + qemu: true steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + if: ${{ matrix.qemu }} == "true" + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 id: docker-buildx @@ -64,3 +75,19 @@ jobs: tags: | jasongdove/ersatztv:${{ inputs.base_version }}${{ matrix.suffix }} jasongdove/ersatztv:${{ inputs.tag_version }}${{ matrix.suffix }} + if: ${{ matrix.name }} != "arm64" + + - name: Build and push + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.docker-buildx.outputs.name }} + context: . + file: ./docker/${{ matrix.path }}Dockerfile + push: true + platforms: 'linux/arm64' + build-args: | + INFO_VERSION=${{ inputs.info_version }}-docker${{ matrix.suffix }} + tags: | + jasongdove/ersatztv:${{ inputs.base_version }}${{ matrix.suffix }} + jasongdove/ersatztv:${{ inputs.tag_version }}${{ matrix.suffix }} + if: ${{ matrix.name }} == "arm64" diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile new file mode 100644 index 000000000..1fb5567ec --- /dev/null +++ b/docker/arm64/Dockerfile @@ -0,0 +1,48 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS dotnet-runtime + +FROM linuxserver/ffmpeg AS runtime-base +COPY --from=dotnet-runtime /usr/share/dotnet /usr/share/dotnet +RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y libicu-dev \ + tzdata \ + fontconfig \ + fonts-dejavu \ + libgdiplus + +# https://hub.docker.com/_/microsoft-dotnet +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +RUN apt-get update && apt-get install -y ca-certificates +RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs +WORKDIR /source + +# copy csproj and restore as distinct layers +COPY *.sln . +COPY nuget.config . +COPY lib/nuget/* ./lib/nuget/ +COPY artwork/* ./artwork/ +COPY ErsatzTV/*.csproj ./ErsatzTV/ +COPY ErsatzTV/client-app/package*.json ./ErsatzTV/client-app/ +COPY ErsatzTV.Application/*.csproj ./ErsatzTV.Application/ +COPY ErsatzTV.Core/*.csproj ./ErsatzTV.Core/ +COPY ErsatzTV.FFmpeg/*.csproj ./ErsatzTV.FFmpeg/ +COPY ErsatzTV.Infrastructure/*.csproj ./ErsatzTV.Infrastructure/ +RUN dotnet restore -r linux-arm64 ErsatzTV/ + +# copy everything else and build app +COPY ErsatzTV/. ./ErsatzTV/ +COPY ErsatzTV.Application/. ./ErsatzTV.Application/ +COPY ErsatzTV.Core/. ./ErsatzTV.Core/ +COPY ErsatzTV.FFmpeg/. ./ErsatzTV.FFmpeg/ +COPY ErsatzTV.Infrastructure/. ./ErsatzTV.Infrastructure/ +WORKDIR /source/ErsatzTV +ARG INFO_VERSION="unknown" +RUN dotnet publish ErsatzTV.csproj --framework net6.0 -c release -o /app --runtime linux-arm64 --no-self-contained --no-restore -p:DebugType=Embedded -p:PublishSingleFile=false -p:PublishTrimmed=false -p:InformationalVersion=${INFO_VERSION} + +# final stage/image +FROM runtime-base +ENV FONTCONFIG_PATH=/etc/fonts +RUN fc-cache update +WORKDIR /app +EXPOSE 8409 +COPY --from=build /app ./ +ENTRYPOINT ["./ErsatzTV"]