2023-11-06 13:17:46 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/runtime:8.0-bookworm-slim AS base
|
2023-08-09 14:23:41 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2023-11-06 13:17:46 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
|
|
|
|
ARG TARGETARCH
|
|
|
|
ENV TZ=Etc/UTC
|
|
|
|
ENV DOTNET_TieredPGO=1
|
|
|
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
|
|
|
|
|
|
RUN echo "Target: $TARGETARCH"
|
|
|
|
RUN echo "Build: $BUILDPLATFORM"
|
2023-08-09 14:23:41 +00:00
|
|
|
WORKDIR /src
|
2023-11-06 13:17:46 +00:00
|
|
|
COPY ["Wonderking/Wonderking.csproj", "Wonderking/"]
|
2023-08-09 20:04:10 +00:00
|
|
|
COPY ["Server/Server.csproj", "Server/"]
|
2023-11-06 13:17:46 +00:00
|
|
|
RUN dotnet restore "Wonderking/Wonderking.csproj" -a $TARGETARCH
|
|
|
|
RUN dotnet restore "Server/Server.csproj" -a $TARGETARCH
|
2023-08-09 14:23:41 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
FROM build AS publish
|
2023-11-06 13:17:46 +00:00
|
|
|
RUN dotnet publish "Server/Server.csproj" -c Release -a $TARGETARCH --no-restore -f net8.0 -o /app
|
2023-08-09 14:23:41 +00:00
|
|
|
|
|
|
|
FROM base AS final
|
|
|
|
WORKDIR /app
|
2023-11-06 13:17:46 +00:00
|
|
|
COPY --from=publish /app .
|
|
|
|
USER $APP_UID
|
|
|
|
ENTRYPOINT ["./Server"]
|
|
|
|
|
|
|
|
|