Refactored dockerfile base and final images
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
# Stage 1: Build environment
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0-bookworm-slim AS build
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
# 1. Explicitly run as root for the build stage
|
||||
USER root
|
||||
WORKDIR /src
|
||||
@@ -17,7 +17,7 @@ RUN dotnet build "LiteCharmsMessaging.csproj" -c Release -o /app/build
|
||||
RUN dotnet publish "LiteCharmsMessaging.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# Stage 2: Runtime environment
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0-bookworm-slim AS final
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
||||
WORKDIR /app
|
||||
|
||||
# 2. Switch to the built-in non-root user ('app') before copying files
|
||||
|
||||
Reference in New Issue
Block a user