最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docker - How to build an ASP.NET Core 9 Blazor app and dockerise it for a 32-bit Raspberry Pi? - Stack Overflow

programmeradmin2浏览0评论

I've built an OSS app using Hosted Blazor WASM (.NET 9), which somebody wants to try on a Raspberry Pi. The app has been dockerised for simple deployment, and I'm using the build-push-action in Github Actions (per this link) to build it and push to Docker Hub.

So in my Dockerfile I have:

FROM --platform=$BUILDPLATFORM mcr.microsoft/dotnet/aspnet:9.0 AS base
WORKDIR /app


FROM --platform=$BUILDPLATFORM mcr.microsoft/dotnet/sdk:9.0 AS publish
WORKDIR /src
COPY . .
WORKDIR "/src"
ARG TARGETARCH
ARG VERSION
RUN dotnet publish MyProject.csproj -a $TARGETARCH -c Release --self-contained true 
         -p:PublishTrimmed=false --property:PublishDir=/app/publish /p:Version=$VERSION

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

ENTRYPOINT ["/app/MyProject", "/appdata"]

and in the Github action I have:

     # Github setup etc... then:

     - name: Build/push develop
        if: github.ref == 'refs/heads/develop'
        uses: docker/build-push-action@v6
        with:
          push: true
          build-args: VERSION=1.0.${{ github.run_number }}-dev
          platforms: linux/arm64, linux/amd64, darwin, linux/arm/v7, linux/arm/v6, linux/arm/v5
          tags: mydockerrepo/myimage:dev

However, when the user tries to run the app on their RPi, they get this error:

exec /app/MyProject: no such file or directory

The RPi is returning this for the OS type:

blah@raspberrypi:~ $ uname -m
armv7l

The docker image works just fine on other OSes (Mac, Linux etc), so I think there's something missing here in terms of the platforms to publish to. What should I pass for a 32bit ARM platform and target architecture? I've gone through pages and pages of docs, but can't seem to find the answer. The challenge here is that I don't have an RPi to test on, and the person who does isn't a developer...

发布评论

评论列表(0)

  1. 暂无评论