FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build RUN apt-get update && apt-get install -y \ curl \ gnupg2 \ libatomic1 \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean # install nodejs RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg ENV NODE_MAJOR=20 RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list RUN apt-get update && apt-get install nodejs -y --no-install-recommends && rm -rf /var/lib/apt/lists/* && apt-get clean # update npm and install pnpm RUN npm install -g npm && npm install -g pnpm && npm cache clean --force WORKDIR /app # install wasm-tools workload RUN dotnet workload install wasm-tools # Copy csproj and restore as distinct layers COPY *.sln . COPY src/NSeguin.Dev.Web/*.csproj ./src/NSeguin.Dev.Web/ COPY src/NSeguin.Dev.Web/packages.lock.json ./src/NSeguin.Dev.Web/ COPY src/NSeguin.Dev.Web/libman.json ./src/NSeguin.Dev.Web/ COPY src/NSeguin.Dev.Web.Client/*.csproj ./src/NSeguin.Dev.Web.Client/ COPY src/NSeguin.Dev.Web.Client/packages.lock.json ./src/NSeguin.Dev.Web.Client/ COPY src/NSeguin.Dev.Web.Common/*.csproj ./src/NSeguin.Dev.Web.Common/ COPY src/NSeguin.Dev.Web.Common/packages.lock.json ./src/NSeguin.Dev.Web.Common/ COPY targets/*.targets ./targets/ COPY targets/*.props ./targets/ COPY Directory.Build.props . COPY Directory.Build.targets . COPY Directory.Packages.props . COPY nuget.config ./ COPY pnpm-lock.yaml ./ COPY tailwind.config.ts ./ COPY package.json ./ COPY global.json ./ RUN dotnet tool restore RUN dotnet restore --configfile nuget.config --locked-mode # Copy everything else and build COPY . ./ RUN dotnet publish ./src/NSeguin.Dev.Web/NSeguin.Dev.Web.csproj -c Release -o out /p:RestoreLockedMode=true # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app COPY --from=build /app/out ./ ENTRYPOINT ["dotnet", "NSeguin.Dev.Web.dll"]