-
When I try to build a multi-platform image following the instructions on the blog post https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/ Failed to build on the arm platform, the Dockerfile is as follows: FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime:9.0-preview-alpine AS base
LABEL Maintainer="WeihanLi"
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview-alpine AS build-env
ARG TARGETARCH
WORKDIR /app
COPY ./src/ ./src/
COPY ./build/ ./build/
COPY ./Directory.Build.props ./
COPY ./Directory.Build.targets ./
COPY ./Directory.Packages.props ./
WORKDIR /app/src/dotnet-exec/
ENV HUSKY=0
RUN dotnet publish -f net9.0 -a $TARGETARCH -o /app/artifacts
FROM base AS final
WORKDIR /app
COPY --from=build-env /app/artifacts/ ./
ENV PATH="/app:${PATH}"
RUN chmod +x ./dotnet-exec
ENTRYPOINT [ "dotnet-exec" ]
CMD [ "--help" ] failed CI: https://github.com/WeihanLi/dotnet-exec/actions/runs/8044724737/job/21968771547 works when only built for full project here: https://github.com/WeihanLi/dotnet-exec/tree/91450ce2cc6f8429830762a3833af2f6cce891db |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ah, found it, should add |
Beta Was this translation helpful? Give feedback.
Ah, found it, should add
--platform=$BUILDPLATFORM
for the sdk image, the failure is using--platform=$BUILDPLATFORM
for the runtime image