Jenkins安装 PowerShell plugin
插件
新建自由项目
拖到 构建
处,添加 PowerShell
构建
贴入下方脚本即可
$ProjectPath = "E:\Perry\Code\XXX\XXXX.Xxxx"
$DllName = "XXXX.Xxxx.dll"
$ImageTag = "xx-xxxx:latest"
$ContainerName = "xx-xxxx"
$RunPort = 5101
cd $ProjectPath
dotnet publish -c Release
set-content bin/Release/net5.0/publish/Dockerfile `
"FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
EXPOSE 80
EXPOSE 443
COPY . .
ENTRYPOINT [""dotnet"", ""$DllName""]
"
docker kill $ContainerName
docker rm -f $ContainerName
docker rmi -f $ImageTag
docker build -t $ImageTag .
docker run -d -p $RunPort:80 --name $ContainerName --restart="always" $ImageTag
手机扫一扫
移动阅读更方便
你可能感兴趣的文章