From c6ca58ab97e9b28602c313adea17b9b1ceec2854 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Sun, 12 Jun 2022 13:42:27 -0500 Subject: [PATCH] build arm32v7 docker image (#842) * build arm32v7 docker image * fix --- .github/workflows/docker.yml | 21 +++++++++++++++- docker/arm32v7/Dockerfile | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 docker/arm32v7/Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f7d3c79fe..0fa979752 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,6 +39,10 @@ jobs: path: 'vaapi/' suffix: '-vaapi' qemu: false + - name: arm32v7 + path: 'arm32v7/' + suffix: '-arm' + qemu: true - name: arm64 path: 'arm64/' suffix: '-arm64' @@ -75,7 +79,7 @@ jobs: tags: | jasongdove/ersatztv:${{ inputs.base_version }}${{ matrix.suffix }} jasongdove/ersatztv:${{ inputs.tag_version }}${{ matrix.suffix }} - if: ${{ matrix.name != 'arm64' }} + if: ${{ matrix.name != 'arm64' && matrix.name != 'arm32v7' }} - name: Build and push uses: docker/build-push-action@v3 @@ -91,3 +95,18 @@ jobs: 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@v3 + with: + builder: ${{ steps.docker-buildx.outputs.name }} + context: . + file: ./docker/${{ matrix.path }}Dockerfile + push: true + platforms: 'linux/arm/v7' + 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 == 'arm32v7' }} diff --git a/docker/arm32v7/Dockerfile b/docker/arm32v7/Dockerfile new file mode 100644 index 000000000..50083ef6e --- /dev/null +++ b/docker/arm32v7/Dockerfile @@ -0,0 +1,48 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal-arm32v7 AS dotnet-runtime + +FROM linuxserver/ffmpeg:arm32v7-version-4.4-cli 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-focal-arm32v7 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-arm 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-arm --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"]