From 6c0343960fbaa0a0197c9739992dfdd6d43e1a2f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 20 Jul 2025 02:55:45 +0800 Subject: [PATCH] :hammer: Fix build script missing npm and node --- DysonNetwork.Pass/Dockerfile | 14 +++++++++++++- DysonNetwork.Sphere/Dockerfile | 20 ++++++++------------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/DysonNetwork.Pass/Dockerfile b/DysonNetwork.Pass/Dockerfile index 5c35aff..5188b94 100644 --- a/DysonNetwork.Pass/Dockerfile +++ b/DysonNetwork.Pass/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base USER $APP_UID WORKDIR /app EXPOSE 8080 @@ -7,8 +7,20 @@ EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src + +# Install Node.js 22 and npm +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl ca-certificates \ + && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get -y install --no-install-recommends nodejs \ + && npm install -g npm \ + && rm -rf /var/lib/apt/lists/* + +# Restore NuGet packages COPY ["DysonNetwork.Pass/DysonNetwork.Pass.csproj", "DysonNetwork.Pass/"] RUN dotnet restore "DysonNetwork.Pass/DysonNetwork.Pass.csproj" + +# Copy everything and build COPY . . WORKDIR "/src/DysonNetwork.Pass" RUN dotnet build "./DysonNetwork.Pass.csproj" -c $BUILD_CONFIGURATION -o /app/build diff --git a/DysonNetwork.Sphere/Dockerfile b/DysonNetwork.Sphere/Dockerfile index cd8e3ea..87cfde5 100644 --- a/DysonNetwork.Sphere/Dockerfile +++ b/DysonNetwork.Sphere/Dockerfile @@ -1,18 +1,6 @@ # -------- Base runtime image -------- FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base -# Install only necessary dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ - libfontconfig1 \ - libfreetype6 \ - libpng-dev \ - libharfbuzz0b \ - libgif7 \ - libvips \ - ffmpeg \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - # Use non-root user if defined in Docker run USER ${APP_UID:-1000} @@ -24,6 +12,14 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src +# Install Node.js 22 and npm +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl ca-certificates \ + && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get -y install --no-install-recommends nodejs \ + && npm install -g npm \ + && rm -rf /var/lib/apt/lists/* + # Copy everything and build COPY . . WORKDIR /src/DysonNetwork.Sphere