🔨 Fix build script missing npm and node

This commit is contained in:
2025-07-20 02:55:45 +08:00
parent f8ee75a50e
commit 6c0343960f
2 changed files with 21 additions and 13 deletions

View File

@@ -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

View File

@@ -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