使用Docker 快速搭建nuget本地服務器,Hosting private nuget server using docker in seconds!


Server

#below line automatically creates the folder, mount the volumes and maps the ports.
docker run -d  -p 8080:80 -v F:/Apps/Docker/nuget/db:/var/www/db -v F:/Apps/Docker/nuget/packages:/var/www/packagefiles  -e NUGET_API_KEY=ee28314c-f7fe-2550-bd77-e09eda3d0119  sunside/simple-nuget-server
#If mapping directory meeting with errors, try using container directory directly inside of it to ensure running.

Then you get the local nuget server running at: http://localhost:8080

Client CLI using choco

choco install -y Nuget.CommandLine
# After nuget installation:
dotnet pack -c Release
nuget push -Source http://localhost:8080/ -ApiKey ee28314c-f7fe-2550-bd77-e09eda3d0119 ClassLibrary.1.0.0.nupkg
#If using dotnet core on Linux, just use below, haven't found a way to check whether a package exists on nuget server
dotnet nuget delete --source http://192.168.1.7:17071/ -k 3cdb9803-86f9-4750-9615-338f14f0c814 --non-interactive EP.${fragment} 1.0.0
dotnet nuget push --source http://192.168.1.7:17071/ -k 3cdb9803-86f9-4750-9615-338f14f0c814 EP.${fragment}.1.0.0.nupkg

Most often package is successfully pushed to server.
In visual studio, add http://localhost:8080 to nuget package source.
Then:

Package can be seen in nuget client gui.
Dont't forget to do the same to all its dependencies, and if other nuget packages referenced, remember to check the api.nuget.org source too.

Then add the package and build:

Below picture looks kind of encouraging!😃)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM