33 lines
1,020 B
Docker
33 lines
1,020 B
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 ["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"]
|