[docker] Only reference TARGETARCH when necessary

This commit is contained in:
Laura Hausmann 2024-04-12 02:06:33 +02:00
parent ad269f1af0
commit 58bd45d0bf
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -1,7 +1,6 @@
# To build with ILLink & AOT enabled, run docker build --target image-aot
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder-jit
ARG TARGETARCH
WORKDIR /src
# copy csproj/fsproj & nuget config, then restore as distinct layers
COPY NuGet.Config /src
@ -10,6 +9,7 @@ COPY Iceshrimp.Parsing/*.fsproj /src/Iceshrimp.Parsing/
COPY Iceshrimp.Frontend/*.csproj /src/Iceshrimp.Frontend/
COPY Iceshrimp.Shared/*.csproj /src/Iceshrimp.Shared/
WORKDIR /src/Iceshrimp.Backend
ARG TARGETARCH
RUN dotnet restore -a $TARGETARCH
# copy build files
@ -19,7 +19,6 @@ COPY . /src/
RUN dotnet publish --no-restore -c Release -a $TARGETARCH -o /app
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS builder-aot
ARG TARGETARCH
RUN dotnet workload install wasm-tools
RUN apt-get update && apt-get install python3 -y
WORKDIR /src
@ -31,6 +30,7 @@ COPY Iceshrimp.Parsing/*.fsproj /src/Iceshrimp.Parsing/
COPY Iceshrimp.Frontend/*.csproj /src/Iceshrimp.Frontend/
COPY Iceshrimp.Shared/*.csproj /src/Iceshrimp.Shared/
WORKDIR /src/Iceshrimp.Backend
ARG TARGETARCH
RUN dotnet restore -a $TARGETARCH
# copy build files