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
# 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
@@ -24,22 +24,25 @@ COPY ["Moonlight.Api/Moonlight.Api.csproj", "Moonlight.Api/"]
COPY ["Moonlight.Frontend/Moonlight.Frontend.csproj", "Moonlight.Frontend/"]
COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"]
RUN dotnet restore "Moonlight.Api/Moonlight.Api.csproj"
RUN dotnet restore "Moonlight.Frontend/Moonlight.Frontend.csproj"
COPY ["Hosts/Moonlight.Frontend.Host/Moonlight.Frontend.Host.csproj", "Hosts/Moonlight.Frontend.Host/"]
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 . .
# Build styles
WORKDIR /src/Moonlight.Frontend/Styles
WORKDIR /src/Hosts/Moonlight.Frontend.Host/Styles
RUN npm run tailwind-build
# Build projects
WORKDIR "/src/Moonlight.Api"
RUN dotnet build "./Moonlight.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build-api
WORKDIR "/src/Hosts/Moonlight.Api.Host"
RUN dotnet build "./Moonlight.Api.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build-api
WORKDIR "/src/Moonlight.Frontend"
RUN dotnet build "./Moonlight.Frontend.csproj" -c $BUILD_CONFIGURATION -o /app/build-frontend
WORKDIR "/src/Hosts/Moonlight.Frontend.Host"
RUN dotnet build "./Moonlight.Frontend.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build-frontend
FROM build AS publish
@@ -47,11 +50,11 @@ FROM build AS publish
ARG BUILD_CONFIGURATION=Release
# Publish applications
WORKDIR "/src/Moonlight.Api"
RUN dotnet publish "./Moonlight.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish-api /p:UseAppHost=false
WORKDIR "/src/Hosts/Moonlight.Api.Host"
RUN dotnet publish "./Moonlight.Api.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish-api /p:UseAppHost=false
WORKDIR "/src/Moonlight.Frontend"
RUN dotnet publish "./Moonlight.Frontend.csproj" -c $BUILD_CONFIGURATION -o /app/publish-frontend /p:UseAppHost=false
WORKDIR "/src/Hosts/Moonlight.Frontend.Host"
RUN dotnet publish "./Moonlight.Frontend.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish-frontend /p:UseAppHost=false
FROM base AS final
@@ -60,4 +63,4 @@ WORKDIR /app
COPY --from=publish /app/publish-api .
COPY --from=publish /app/publish-frontend/wwwroot ./wwwroot
ENTRYPOINT ["dotnet", "Moonlight.Api.dll"]
ENTRYPOINT ["dotnet", "Moonlight.Api.Host.dll"]