Auto build docker image for simple-nuget-server
api_key=`openssl rand -base64 32`
docker run -d --name nuget-server -p 443:443 -v /srv/nuget/tls:/etc/nginx/tls:ro -e HTTPS_ENABLE=true -e NUGET_API_KEY=$api_key agowa338/docker-nuget-serverapi_key=`openssl rand -base64 32`
docker run -d --name nuget-server -p 80:80 -e NUGET_API_KEY=$api_key agowa338/docker-nuget-serverMake sure your Host feed is available on either port 80 or 443.
If you use https, port 80 redirects to 443 with tls enabled.
version: '2'
services:
nuget-server:
container_name: nuget-server
image: agowa338/docker-nuget-server:latest
ports:
- "443:443"
- "80:80"
restart: always
environment:
NUGET_API_KEY: "2bYS9RO2DYBc4CbPRuE3AoTlDVoiLM24pbkhPk1D83w="
UPLOAD_MAX_FILESIZE: "40M"
# SERVER_NAME: "nuget.example.com" # Also ip addresses can be used.
WORKER_PROCESSES: "4"
WORKER_CONNECTIONS: "65535"
volumes:
- nuget-db:/var/www/simple-nuget-server/db:rw
- nuget-packagefiles:/var/www/simple-nuget-server/packagefiles:rw
- nuget-tls:/etc/nginx/tls:ro
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
volumes:
nuget-db:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/srv/nuget/db'
nuget-packagefiles:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/srv/nuget/packagefiles'
nuget-tls:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/srv/nuget/tls'version: '2'
services:
nuget-server:
container_name: nuget-server
image: agowa338/docker-nuget-server:latest
ports:
- "80:80"
restart: always
environment:
NUGET_API_KEY: "2bYS9RO2DYBc4CbPRuE3AoTlDVoiLM24pbkhPk1D83w="
UPLOAD_MAX_FILESIZE: "40M"
# SERVER_NAME: "nuget.example.com" # Also ip addresses can be used.
WORKER_PROCESSES: "4"
WORKER_CONNECTIONS: "65535"
volumes:
- nuget-db:/var/www/simple-nuget-server/db:rw
- nuget-packagefiles:/var/www/simple-nuget-server/packagefiles:rw
- nuget-tls:/etc/nginx/tls:ro
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
volumes:
nuget-db:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/srv/nuget/db'
nuget-packagefiles:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/srv/nuget/packagefiles'
nuget-tls:-
NUGET_API_KEY: set nuget api key. By default the key is generated randomly -
UPLOAD_MAX_FILESIZE: set the maximum size of an uploaded nuget package file. Default size:20M -
WORKER_PROCESSES: set nginx worker processes.Default:1 -
WORKER_CONNECTIONS: set nginx worker connections. Default:65535 -
SERVER_NAME: set server domain name,must set value with your server name or ip. Default:localhost -
HTTPS_ENABLE: If set to any value (even if set to false!), nginx will be started by using the tls configuration. It cannot be changed after the first launch, you'll have to start a new instance.Note: If use
hostnetwork mode,you can setSERVER_PORTvalue to change nuget server port.
/var/www/simple-nuget-server/dbPath with SQLite database./var/www/simple-nuget-server/packagefilesPath with nuget packages save./etc/nginx/tlsPath with nginx tls configuration. If you want to use https, please mount this path, generate cert/key and dhparameter to support https.
If you use TLS for your feed, your certificate files have to be within the nuget-tls-directory:
cert.pemCertificate including all intermediate ca certificates.dhparam.pem4096-Bit DH-Parameters (generated byopenssl dhparam -out dhparam4096.pem 4096).key.pemPrivate key for your certificate.
For testing, you can either use
- the nuget commandline tool or
- PowerShell
nuget push xxx.nupkg -source SERVER_NAME -apikey NUGET_API_KEYnuget install xxx -source SERVER_NAME -packagesavemode nupkg$api_key = "NUGET_API_KEY"
Register-PSRepository -Name MyRepository -SourceLocation https://nuget.example.com/ -PublishLocation https://nuget.example.com/ -InstallationPolicy Trusted
Publish-Module -NuGetApiKey $api_key -Name PackageManagement -Repository MyRepository
Publish-Module -NuGetApiKey $api_key -Name PowerShellGet -Repository MyRepository