continuity/Server/Dockerfile
Timothy Schenk c197afc750
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 24s
Build, Package and Push Images / sbom-scan (push) Successful in 30s
Build, Package and Push Images / sonarqube (push) Successful in 1m24s
Build, Package and Push Images / container-build (push) Successful in 1m26s
Build, Package and Push Images / container-sbom-scan (push) Successful in 36s
chore: move to alpine image
2023-11-14 22:38:43 +01:00

28 lines
766 B
Docker

FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base
WORKDIR /app
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine 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"
WORKDIR /src
COPY ["Wonderking/Wonderking.csproj", "Wonderking/"]
COPY ["Server/Server.csproj", "Server/"]
RUN dotnet restore "Wonderking/Wonderking.csproj" -a $TARGETARCH
RUN dotnet restore "Server/Server.csproj" -a $TARGETARCH
COPY . .
FROM build AS publish
RUN dotnet publish "Server/Server.csproj" -c Release -a $TARGETARCH --no-restore -f net8.0 -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
USER $APP_UID
ENTRYPOINT ["./Server"]