Run BaGetter on Docker
Configure BaGetter (optional)
Create a file named bagetter.env
to store BaGetter's configurations:
# The following config is the API Key used to publish packages.
# You should change this to a secret value to secure your server.
ApiKey=NUGET-SERVER-API-KEY
Storage__Type=FileSystem
Storage__Path=/data
Database__Type=Sqlite
Database__ConnectionString=Data Source=/data/db/bagetter.db
Search__Type=Database
For a full list of configurations, please refer to BaGetter's configuration guide.
The bagetter.env
file stores BaGetter's configuration as environment variables.
Alternatively, the configuration can be injected via environment variables directly, e.g. the environment
array in a docker compose file or the --env
flag in a docker run
command.
To learn how these configurations work, please refer to ASP.NET Core's configuration documentation.
If this step is omitted the default mode (unconfigured) will be Sqlite with the sql blobs stored in the path /data/db/bagetter.db
.
Run BaGetter
- Create a folder named
bagetter-data
in the same directory as thebagetter.env
file. This will be used by BaGetter to persist its state. - Pull BaGetter's latest docker image:
docker pull bagetter/bagetter
You can now run BaGetter...
- ...with optional
.env
file:
docker run --rm --name nuget-server -p 5000:8080 --env-file bagetter.env -v "$(pwd)/bagetter-data:/data" bagetter/bagetter:latest
- ...or without:
docker run --rm --name nuget-server -p 5000:8080 -v "$(pwd)/bagetter-data:/data" bagetter/bagetter:latest
Publish packages
Publish your first package with:
dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY package.1.0.0.nupkg
Publish your first symbol package with:
dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY symbol.package.1.0.0.snupkg
The default API Key to publish packages is NUGET-SERVER-API-KEY
.
You should change this to a secret value to secure your server. See Configure BaGetter.
Browse packages
You can browse packages by opening the URL http://localhost:5000/
in your browser.
Restore packages
You can restore packages by using the following package source:
http://localhost:5000/v3/index.json
Some helpful guides:
Symbol server
You can load symbols by using the following symbol location:
http://localhost:5000/api/download/symbols
For Visual Studio, please refer to the Configure Debugging guide.
Running BaGetter behind a reverse proxy
BaGetter can be run behind a reverse proxy in order to provide HTTPS, your own domain, and other features. For the API to deliver proper URLs, the proxy needs to forward the X-Forwarded-Host
header, or the Host
header iteslf.
For more information, please refer to the ASP.NET Core documentation.