Adjusted dockerfile for library-host architecture

This commit is contained in:
2025-12-27 23:32:54 +01:00
parent e1c0645428
commit 1581276854

View File

@@ -11,9 +11,9 @@ RUN apt-get update; apt-get install nodejs npm -y; apt-get clean
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
# Download npm packages # Download npm packages
WORKDIR /src/Moonlight.Frontend/Styles WORKDIR /src/Hosts/Moonlight.Frontend.Host/Styles
COPY ["Moonlight.Frontend/Styles/package.json", "package.json"] COPY ["Hosts/Moonlight.Frontend.Host/Styles/package.json", "package.json"]
RUN npm install RUN npm install
@@ -24,22 +24,25 @@ COPY ["Moonlight.Api/Moonlight.Api.csproj", "Moonlight.Api/"]
COPY ["Moonlight.Frontend/Moonlight.Frontend.csproj", "Moonlight.Frontend/"] COPY ["Moonlight.Frontend/Moonlight.Frontend.csproj", "Moonlight.Frontend/"]
COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"] COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"]
RUN dotnet restore "Moonlight.Api/Moonlight.Api.csproj" COPY ["Hosts/Moonlight.Frontend.Host/Moonlight.Frontend.Host.csproj", "Hosts/Moonlight.Frontend.Host/"]
RUN dotnet restore "Moonlight.Frontend/Moonlight.Frontend.csproj" COPY ["Hosts/Moonlight.Api.Host/Moonlight.Api.Host.csproj", "Hosts/Moonlight.Api.Host/"]
RUN dotnet restore "Hosts/Moonlight.Api.Host/Moonlight.Api.Host.csproj"
RUN dotnet restore "Hosts/Moonlight.Frontend.Host/Moonlight.Frontend.Host.csproj"
# Copy over the whole sources # Copy over the whole sources
COPY . . COPY . .
# Build styles # Build styles
WORKDIR /src/Moonlight.Frontend/Styles WORKDIR /src/Hosts/Moonlight.Frontend.Host/Styles
RUN npm run tailwind-build RUN npm run tailwind-build
# Build projects # Build projects
WORKDIR "/src/Moonlight.Api" WORKDIR "/src/Hosts/Moonlight.Api.Host"
RUN dotnet build "./Moonlight.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build-api RUN dotnet build "./Moonlight.Api.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build-api
WORKDIR "/src/Moonlight.Frontend" WORKDIR "/src/Hosts/Moonlight.Frontend.Host"
RUN dotnet build "./Moonlight.Frontend.csproj" -c $BUILD_CONFIGURATION -o /app/build-frontend RUN dotnet build "./Moonlight.Frontend.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build-frontend
FROM build AS publish FROM build AS publish
@@ -47,11 +50,11 @@ FROM build AS publish
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
# Publish applications # Publish applications
WORKDIR "/src/Moonlight.Api" WORKDIR "/src/Hosts/Moonlight.Api.Host"
RUN dotnet publish "./Moonlight.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish-api /p:UseAppHost=false RUN dotnet publish "./Moonlight.Api.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish-api /p:UseAppHost=false
WORKDIR "/src/Moonlight.Frontend" WORKDIR "/src/Hosts/Moonlight.Frontend.Host"
RUN dotnet publish "./Moonlight.Frontend.csproj" -c $BUILD_CONFIGURATION -o /app/publish-frontend /p:UseAppHost=false RUN dotnet publish "./Moonlight.Frontend.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish-frontend /p:UseAppHost=false
FROM base AS final FROM base AS final
@@ -60,4 +63,4 @@ WORKDIR /app
COPY --from=publish /app/publish-api . COPY --from=publish /app/publish-api .
COPY --from=publish /app/publish-frontend/wwwroot ./wwwroot COPY --from=publish /app/publish-frontend/wwwroot ./wwwroot
ENTRYPOINT ["dotnet", "Moonlight.Api.dll"] ENTRYPOINT ["dotnet", "Moonlight.Api.Host.dll"]