Skip to content

Commit a229f56

Browse files
fix: remove credentials file before layer is committed
Deleting ~/.nuget/config/credentials.config in the same RUN instruction ensures the PAT never appears in the final layer snapshot (create + delete in one RUN = net zero diff). Prevents credential leakage into BuildKit layer cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6b3aa9a commit a229f56

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

EssentialCSharp.Web/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ RUN --mount=type=secret,id=nugetconfig,required=false \
2525
fi && \
2626
dotnet restore "EssentialCSharp.Web.slnx" -p:AccessToNugetFeed=$ACCESS_TO_NUGET_FEED && \
2727
dotnet build "EssentialCSharp.Web.slnx" -c Release --no-restore -p:AccessToNugetFeed=$ACCESS_TO_NUGET_FEED -p:ReleaseDateAttribute=True -p:SkipFrontendBuild=true && \
28-
dotnet publish "EssentialCSharp.Web.slnx" -c Release -p:PublishDir=/app/publish -p:UseAppHost=false -p:SkipFrontendBuild=true --no-build
28+
dotnet publish "EssentialCSharp.Web.slnx" -c Release -p:PublishDir=/app/publish -p:UseAppHost=false -p:SkipFrontendBuild=true --no-build && \
29+
rm -f ~/.nuget/config/credentials.config
2930

3031
FROM base AS final
3132
WORKDIR /app

0 commit comments

Comments
 (0)