Refactored docker file

This commit is contained in:
2026-07-09 22:58:14 +02:00
parent 0605876155
commit 1abfb0a198
+8
View File
@@ -2,6 +2,7 @@
# STAGE 1: Build & Compile Tailwind CSS (Node.js + Yarn)
# =========================================================================
FROM node:20-alpine AS tailwind-builder
USER root
WORKDIR /src
# Copy package descriptors first to leverage Docker layer caching
@@ -27,6 +28,7 @@ RUN mkdir -p wwwroot && \
# STAGE 2: Restore, Build, & Publish .NET 10 Application
# =========================================================================
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS dotnet-builder
USER root
# Install Node.js & Yarn in the .NET builder stage to support MSBuild frontend compilation targets
RUN apt-get update && apt-get install -y curl && \
@@ -49,6 +51,12 @@ COPY Tmt.SaqaTravel/ ./Tmt.SaqaTravel/
# Overwrite / insert the pre-compiled, minified Tailwind CSS stylesheet from Stage 1
COPY --from=tailwind-builder /src/Tmt.SaqaTravel/wwwroot/app.min.css ./Tmt.SaqaTravel/wwwroot/app.min.css
# Copy restored node_modules from Stage 1 to support any custom MSBuild targets that run node/yarn scripts
COPY --from=tailwind-builder /src/Tmt.SaqaTravel/node_modules ./Tmt.SaqaTravel/node_modules
# Ensure root permissions are configured across the entire working directory
RUN chmod -R 755 /src
# Compile and publish the release-ready Blazor app (No AppHost, single-file DLL bundle)
WORKDIR /src/Tmt.SaqaTravel
RUN dotnet publish Tmt.SaqaTravel.csproj -c Release -o /app/publish /p:UseAppHost=false