🗑️ Remove SPA builder from dockerfile

This commit is contained in:
2025-09-19 00:17:22 +08:00
parent 634958ffc5
commit 2ace444dbb
16 changed files with 174 additions and 846 deletions

View File

@@ -3,6 +3,8 @@ WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# Stage 1: Install runtime dependencies
# Install only necessary dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libfontconfig1 \
@@ -17,24 +19,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
USER $APP_UID
# Stage 2: Build SPA
FROM node:22-alpine AS spa-builder
WORKDIR /src
# Copy package files for SPA
COPY ["DysonNetwork.Drive/Client/package.json", "DysonNetwork.Drive/Client/package-lock.json*", "./Client/"]
# Install SPA dependencies
WORKDIR /src/Client
RUN npm install
# Copy SPA source
COPY ["DysonNetwork.Drive/Client/", "./"]
# Build SPA
RUN npm run build
# Stage 3: Build .NET application
# Stage 2: Build .NET application
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
@@ -42,9 +27,6 @@ COPY ["DysonNetwork.Drive/DysonNetwork.Drive.csproj", "DysonNetwork.Drive/"]
RUN dotnet restore "DysonNetwork.Drive/DysonNetwork.Drive.csproj"
COPY . .
# Copy built SPA to wwwroot
COPY --from=spa-builder /src/Client/dist /src/DysonNetwork.Drive/wwwroot/dist
WORKDIR "/src/DysonNetwork.Drive"
RUN dotnet build "./DysonNetwork.Drive.csproj" -c $BUILD_CONFIGURATION -o /app/build \
-p:TypeScriptCompileBlocked=true \