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
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
RUN ls
RUN ls ./
COPY ["MauMau-Server.csproj", "./"]
RUN dotnet restore "MauMau-Server.csproj"
ARG TARGETARCH
ARG TARGETOS
RUN arch=$TARGETARCH \
&& if [ "$arch" = "amd64" ]; then arch="x64"; fi \
&& echo $TARGETOS-$arch > /tmp/rid
COPY *.csproj .
RUN dotnet restore -r $(cat /tmp/rid)
COPY . .
WORKDIR "/src"
RUN dotnet build "MauMau-Server.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MauMau-Server.csproj" -c Release -o /app/publish
RUN dotnet publish -c Release -o /app -r $(cat /tmp/rid) --self-contained false --no-restore
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build /app .
ENTRYPOINT ["dotnet", "MauMau-Server.dll"]