Docker安装BaGet

BaGet(发音为“baguette”)是一款轻量级 NuGet 和符号服务器。它是开源的、跨平台的,并且适用于云!
文档:https://loic-sharma.github.io/BaGet/

mkdir -p /root/baget/data
mkdir -p /root/baget/conf

# 写入配置文件
echo '
{
  //api密钥适当修改
  "ApiKey": "123321",
  "PackageDeletionBehavior": "Unlist",
  "AllowPackageOverwrites": false,

  //默认使用Sqlite 支持 mysql
  "Database": {
    "Type": "Sqlite",
    "ConnectionString": "Data Source=/var/baget/baget.db"
  },
  //包文件位置
  "Storage": {
    "Type": "FileSystem",
    "Path": "/var/baget/packages"
  },

  "Search": {
    "Type": "Database"
  },
  //是否启用上游搜索地址
  "Mirror": {
    "Enabled": true,
    // Uncomment this to use the NuGet v2 protocol
    //"Legacy": true,
    "PackageSource": "https://api.nuget.org/v3/index.json"
  },

  // Uncomment this to configure BaGet to listen to port 8080.
  // See: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#listenoptionsusehttps
  //"Kestrel": {
  //  "Endpoints": {
  //    "Http": {
  //      "Url": "http://localhost:8080"
  //    }
  //  }
  //},

  "Logging": {
    "IncludeScopes": false,
    "Debug": {
      "LogLevel": {
        "Default": "Warning"
      }
    },
    "Console": {
      "LogLevel": {
        "Microsoft.Hosting.Lifetime": "Information",
        "Default": "Warning"
      }
    }
  }
}
' > /root/baget/conf/appsettings.json

# docker run
docker run  --name nuget-server -d -p 5800:80 -v /root/baget/data:/var/baget -v /root/baget/conf/appsettings.json:/app/appsettings.json loicsharma/baget:latest

访问127.0.0.1:5800 大功告成