Possible dockerfile fix
Some checks failed
Build Mau & Deploy Mau / build (push) Successful in 1m26s
Build Mau & Deploy Mau / deploy (push) Failing after 1m47s

This commit is contained in:
DTieman
2024-04-14 12:38:26 +02:00
parent 87587c086f
commit 0ec8f66826

View File

@@ -2,20 +2,20 @@
WORKDIR /app WORKDIR /app
EXPOSE 5000 EXPOSE 5000
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim-amd64 AS build
WORKDIR /src WORKDIR /src
RUN ls ARG TARGETARCH
RUN ls ./ ARG TARGETOS
COPY ["MauMau-Server.csproj", "./"] RUN arch=$TARGETARCH \
RUN dotnet restore "MauMau-Server.csproj" && if [ "$arch" = "amd64" ]; then arch="x64"; fi \
&& echo $TARGETOS-$arch > /tmp/rid
COPY *.csproj .
RUN dotnet restore -r $(cat /tmp/rid)
COPY . . COPY . .
WORKDIR "/src" WORKDIR "/src"
RUN dotnet build "MauMau-Server.csproj" -c Release -o /app/build RUN dotnet publish -c Release -o /app -r $(cat /tmp/rid) --self-contained false --no-restore
FROM build AS publish
RUN dotnet publish "MauMau-Server.csproj" -c Release -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=build /app .
ENTRYPOINT ["dotnet", "MauMau-Server.dll"] ENTRYPOINT ["dotnet", "MauMau-Server.dll"]