galaeth-draft/Dockerfile

34 lines
1 KiB
Docker

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETARCH
ARG BUILDPLATFORM
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Galaeth.ApiServer/Galaeth.ApiServer.csproj", "Galaeth.ApiServer/"]
COPY ["Galaeth.Core/Galaeth.Core.csproj", "Galaeth.Core/"]
COPY ["Galaeth.Services/Galaeth.Services.csproj", "Galaeth.Services/"]
COPY ["Galaeth.DAL/Galaeth.DAL.csproj", "Galaeth.DAL/"]
RUN dotnet restore "Galaeth.ApiServer/Galaeth.ApiServer.csproj"
COPY . .
WORKDIR "/src/Galaeth.ApiServer"
RUN dotnet build "Galaeth.ApiServer.csproj" -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/build
FROM build AS publish
ARG TARGETARCH
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Galaeth.ApiServer.csproj" --no-restore -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Galaeth.ApiServer.dll"]