fix(docker): cross-compile API image without QEMU SDK
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
dotnet restore under emulated arm64 aborts on the amd64 runner; build on BUILDPLATFORM and publish with -a TARGETARCH instead.
This commit is contained in:
1 parent
eb314da7c6
commit
9854f84298
1 file changed
+11
-3
+11
-3
@@ -1,8 +1,16 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
# syntax=docker/dockerfile:1
|
||||||
|
# Build on the runner arch (amd64); publish for TARGETARCH (arm64 on Pi).
|
||||||
|
# Avoids QEMU-emulated dotnet restore, which aborts under plugins/docker --platform.
|
||||||
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY src/backend/ .
|
COPY src/backend/ .
|
||||||
RUN dotnet restore iLED.slnx
|
RUN dotnet restore iLED.slnx -a $TARGETARCH
|
||||||
RUN dotnet publish src/iLED.Api/iLED.Api.csproj -c Release -o /app/publish
|
RUN dotnet publish src/iLED.Api/iLED.Api.csproj \
|
||||||
|
-c Release \
|
||||||
|
-o /app/publish \
|
||||||
|
-a $TARGETARCH \
|
||||||
|
--no-restore
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
Reference in new issue
Block a user