Restore NuGet Packages from a Private Feed when building Docker Containers
Asked Answered
T

1

7

We have a windows service application built using .Net framework 4.6.2. This .Net project is having references to Nuget packages from a custom Nuget feed. We have a requirement to use DevOps pipeline to build docker image, push docker image to Azure Container Registry and publish docker image to Azure Kubernetes Services (AKS).

I’ve taken below github example as a reference and created a docker file.

https://github.com/mihaitibrea/docker-windows-service/blob/master/WindowsContainer.Wrapper/ServiceWrapper.dockerfile

I’ve configured packageSources and PackageSourceCredentials within nuget.config for docker to be able to pull nuget packages from custom feed.

But, this approach requires a personal access token to be updated after it expires.

Do you have any alternate solutions for resolving the NuGet restore from the custom feed?

Tieratierce answered 25/8, 2022 at 6:45 Comment(1)
I've generated a personal access token (PAT) generated from azure devops with the access to read nuget packages (Packaging: Read) and configured it in NuGet.ConfigTieratierce
N
10

This github repository shows a few different methods how to use private feeds.

Nosewheel answered 25/8, 2022 at 8:15 Comment(1)
Thanks for your reference. I've come across this reference already. But, I'm yet to check on Azure Artifact Credential Provider.Tieratierce

© 2022 - 2024 — McMap. All rights reserved.