1、源代码编译后输出,针对NET5.0\6.0,7.0应该可以跟JAVA一样了
Jenkins配置netcore发布到Liunx下
1、构建部分:
execute Windows batch command
命令:
@echo off
echo 编译代码...
cd "%WORKSPACE%"
if exist %JOB_NAME%.zip del /s/q %JOB_NAME%.zip
if not exist D:\PM\temp\test\%JOB_NAME% md D:\PM\temp\test\%JOB_NAME%
echo "D:\PM\temp\%JOB_NAME%\%BUILD_ID%"
dotnet restore
dotnet build
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dotnet publish -o D:\PM\temp\test\%JOB_NAME%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
copy %WORKSPACE%\Dockerfile D:\PM\temp\test\%JOB_NAME%\
cd D:\PM\temp\test\%JOB_NAME%
D:\"Program Files"\WinRAR\WinRAR.exe a -k -r -s -m1 %JOB_NAME%.zip
copy D:\PM\temp\test\%JOB_NAME%\%JOB_NAME%.zip %WORKSPACE%\%JOB_NAME%.zip
cd D:\PM\temp\test
rmdir /s/q %JOB_NAME%
:ERROR
ECHO command failed
GOTO END
:END
IF %ERRORLEVEL% GEQ 0 EXIT /B %ERRORLEVEL%
EXIT /B 0
构建后操作:
1、Send build artifacts over SSH
Transfers:
1、Source Files \*.zip
2、Remove perfix \
3、Remote directory build/
4、Exec command
cd /usr/pm/buil

本文介绍如何通过Jenkins自动构建并部署.NET Core应用程序至Linux环境。具体步骤包括使用dotnet命令进行源代码的编译、打包,以及通过SSH发送构建产物到远程服务器,并利用Docker容器化运行。
最低0.47元/天 解锁文章
4355

被折叠的 条评论
为什么被折叠?



