🐛 I... just want the build work so I can go to sleep...

This commit is contained in:
2025-07-20 03:15:14 +08:00
parent 7ce41e06a7
commit bedb9f81f1
2 changed files with 7 additions and 37 deletions

View File

@@ -14,7 +14,7 @@ COPY ["DysonNetwork.Pass/Client/package.json", "DysonNetwork.Pass/Client/package
# Install SPA dependencies
WORKDIR /src/Client
RUN npm ci
RUN npm install
# Copy SPA source
COPY ["DysonNetwork.Pass/Client/", "./"]

View File

@@ -1,53 +1,23 @@
# -------- Base runtime image --------
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
# Use non-root user if defined in Docker run
USER ${APP_UID:-1000}
USER $APP_UID
WORKDIR /app
EXPOSE 8080 8081
EXPOSE 8080
EXPOSE 8081
# -------- Build stage --------
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# Copy only the necessary project files first for better layer caching
COPY ["DysonNetwork.Sphere/DysonNetwork.Sphere.csproj", "DysonNetwork.Sphere/"]
COPY ["DysonNetwork.Shared/DysonNetwork.Shared.csproj", "DysonNetwork.Shared/"]
# Restore NuGet packages
RUN dotnet restore "DysonNetwork.Sphere/DysonNetwork.Sphere.csproj"
# Copy the rest of the source code
COPY . .
# Build the project (this will skip frontend build as it's not needed)
WORKDIR "/src/DysonNetwork.Sphere"
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build \
--no-restore \
-p:TypeScriptCompileBlocked=true \
-p:UseRazorBuildServer=false
RUN dotnet build "./DysonNetwork.Sphere.csproj" -c $BUILD_CONFIGURATION -o /app/build
# -------- Publish stage --------
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./DysonNetwork.Sphere.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# Publish the application without frontend assets
RUN dotnet publish "DysonNetwork.Sphere.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/publish \
--no-restore \
--no-build \
-p:PublishReadyToRun=true \
-p:TieredPGO=true \
-p:SuppressTrimAnalysisWarnings=true \
-p:TypeScriptCompileBlocked=true \
-p:UseRazorBuildServer=false
# -------- Final image --------
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DysonNetwork.Sphere.dll"]
ENTRYPOINT ["dotnet", "DysonNetwork.Sphere.dll"]