asarafian/mininugetserver
A container for a simple [Nuget Server](http://nugetserver.net/)
108
This repository is a proof of concept to build an ASP.NET (not .NET core) web application in a Windows Container. The web application I chose is a simple implementation of the a Nuget Server.
Containerizing this Nuget Server needs to address a couple of issues:
web.config
parameters such as apiKey
during docker run
. An alternative could be when building but I prefer the run option.packagesPath
parameter to an external volume.Use the wiki pages to track the progress and answers to these questions.
My goal is to publish this container to asarafian/mininugetserver to help me and others quickly setup a dev/tested oriented nuget feed. My ultimate goal is to automate fully the build and publishing of the container and make it available to Azure and AWS windows containers.
Container is available on asarafian/mininugetserver.
Within Source there is the a Visual Studio 2015 solution that is in effect an empty web application with reference to the Nuget.Server package. All files in the repository favor debugging and troubleshooting.
The docker file is self contained. That means it will install all necessary tools to build and publish the solution from within the container.
To build the container manually execute .\Scripts\Debug-Container.ps1 -Build -ErrorAction Stop
.
Within Scripts execute the Start-Container.ps1
to start the container.
If everything goes well it will produce the url that for the containerized MiniNugetServer.
If you want to run manually then standard docker run
can be used with option definition of environment parameters apikey and packagesFolder. Examples:
docker run -d -p 8080:80 --name mininugetserver asarafian/mininugetserver
docker run -d -p 8080:80 -e apikey=mininugetserver -e packagesPath=~/Packages --name mininugetserver asarafian/mininugetserver
C:\Shared\Packages
on the host as the packagesFolder (C:\Packages
within the container) by mounting volumes: docker run -d -p 8080:80 -v C:/Shared/Packages/:C:/Packages -e apikey=mininugetserver -e packagesPath=C:/Packages --name mininugetserver asarafian/mininugetserver
To scale the containers you can use define docker compose configuration file referencing the asarafian/mininugetserver. To make sure they all behave the same and reference the same packages folder, define the apikey and/or packagesFolder environment variables. The packagesFolder folder must specify to a common folder on the host that needs to be mounted to each container.
This is an example docker-compose file
version: '2.1'
services:
mininugetserver:
image: asarafian/mininugetserver
environment:
apikey: "mininugetserver"
packagesPath: "C:\Packages"
volumes:
- C:\MiniNuGetServer\Packages/:C:\Packages
networks:
default:
external:
name: nat
To launch scale with e.g. 2 mininugetserver
instances execute docker-compose scale mininugetserver=2
.
To help tests within a container execute .\Scripts\Debug-Container.ps1 -WindowsServer -Start cmd -ErrorAction Stop
.
This will start a microsoft/windowsservercore instance with the shell.
What is important is that withing the instance the "C:\Repository" will point to the root of the repository.
To debug, copy any fragment from the docker file and execute within the container.
Assuming the image for asarafian/mininugetserver:latest is built the Test-All.ps1 will execute and test the following sequence:
docker run
and acquire the IP. Acquire also the IP address.Register-PSRepository
.Find-Module
.Save-Module
and Publish-Module
.Find-Module
.Find-Module
.Please submit your ideas in code or with issues. Don't forget to check the wiki pages to identify current progress.
docker pull asarafian/mininugetserver