Skip to content

Commit 5a5f58d

Browse files
fix: switch NuGet auth to config layering to preserve packageSourceMapping
Replace --configfile (which drops all other NuGet config) with copying a credentials-only file to ~/.nuget/config/credentials.config so NuGet merges it with the repo's nuget.config (including packageSourceMapping). - Add required=false to secret mount (explicit optional behavior) - Generate credentials-only config in CI (nuget.config remains single source of truth for feeds and packageSourceMapping) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 26ebbed commit 5a5f58d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

EssentialCSharp.Web/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ ENV ACCESS_TO_NUGET_FEED=$ACCESS_TO_NUGET_FEED
1818
WORKDIR /src
1919
COPY . .
2020
COPY --from=frontend-build /frontend/EssentialCSharp.Web/wwwroot/dist ./EssentialCSharp.Web/wwwroot/dist
21-
RUN --mount=type=secret,id=nugetconfig \
21+
RUN --mount=type=secret,id=nugetconfig,required=false \
2222
if [ "$ACCESS_TO_NUGET_FEED" = "true" ] && [ -f /run/secrets/nugetconfig ]; then \
23-
dotnet restore "EssentialCSharp.Web.slnx" --configfile /run/secrets/nugetconfig -p:AccessToNugetFeed=$ACCESS_TO_NUGET_FEED; \
24-
else \
25-
dotnet restore "EssentialCSharp.Web.slnx" -p:AccessToNugetFeed=$ACCESS_TO_NUGET_FEED; \
23+
mkdir -p ~/.nuget/config && \
24+
cp /run/secrets/nugetconfig ~/.nuget/config/credentials.config; \
2625
fi && \
26+
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 && \
2828
dotnet publish "EssentialCSharp.Web.slnx" -c Release -p:PublishDir=/app/publish -p:UseAppHost=false -p:SkipFrontendBuild=true --no-build
2929

0 commit comments

Comments
 (0)