astral-api/Dockerfile

34 lines
1,020 B
Text
Raw Normal View History

2024-12-15 21:43:00 +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
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Astral.ApiServer/Astral.ApiServer.csproj", "Astral.ApiServer/"]
COPY ["Astral.Core/Astral.Core.csproj", "Astral.Core/"]
COPY ["Astral.Services/Astral.Services.csproj", "Astral.Services/"]
COPY ["Astral.DAL/Astral.DAL.csproj", "Astral.DAL/"]
RUN dotnet restore "Astral.ApiServer/Astral.ApiServer.csproj"
COPY . .
WORKDIR "/src/Astral.ApiServer"
RUN dotnet build "Astral.ApiServer.csproj" -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/build
FROM build AS publish
ARG TARGETARCH
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Astral.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", "Astral.ApiServer.dll"]