galaeth-draft/Dockerfile

34 lines
1 KiB
Docker
Raw Permalink Normal View History

2024-11-17 10:31:01 +01:00
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
2024-11-17 10:31:01 +01:00
ARG BUILD_CONFIGURATION=Release
2024-11-17 10:31:01 +01:00
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"
2024-11-17 10:31:01 +01:00
COPY . .
WORKDIR "/src/Galaeth.ApiServer"
RUN dotnet build "Galaeth.ApiServer.csproj" -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/build
2024-11-17 10:31:01 +01:00
FROM build AS publish
ARG TARGETARCH
2024-11-17 10:31:01 +01:00
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Galaeth.ApiServer.csproj" --no-restore -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/publish /p:UseAppHost=false
2024-11-17 10:31:01 +01:00
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Galaeth.ApiServer.dll"]