自动打包修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
be5c9b636e
commit
a536c33302
|
@ -2,39 +2,73 @@ kind: pipeline
|
|||
type: docker
|
||||
name: irc-netcore-api
|
||||
|
||||
clone:
|
||||
disable: true #禁用默认克隆
|
||||
|
||||
steps:
|
||||
- name: clone-repo
|
||||
image: alpine/git
|
||||
pull: if-not-exists
|
||||
volumes:
|
||||
- name: irc-test-work
|
||||
path: /work
|
||||
commands:
|
||||
- if [ ! -e /work/netcore-repo/.git ]; then
|
||||
git clone -b Test.IRC http://192.168.3.68:2000/XCKJ/irc-netcore-api.git /work/netcore-repo;
|
||||
else
|
||||
cd /work/netcore-repo;
|
||||
git pull;
|
||||
fi
|
||||
|
||||
- |
|
||||
if [ ! -e Dockerfile ]; then
|
||||
echo 'FROM mcr.microsoft.com/dotnet/aspnet:6.0
|
||||
EXPOSE 80
|
||||
WORKDIR /app
|
||||
COPY publish .
|
||||
ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"]' > /work/Dockerfile
|
||||
fi
|
||||
|
||||
- name: restore-publish
|
||||
image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
pull: if-not-exists
|
||||
depends_on:
|
||||
- clone-repo
|
||||
volumes:
|
||||
- name: nuget-packages
|
||||
path: /root/.nuget/packages
|
||||
- name: irc-test-work
|
||||
path: /work
|
||||
commands:
|
||||
- cd /work/netcore-repo/IRaCIS.Core.API
|
||||
- dotnet restore ./IRaCIS.Core.API.csproj
|
||||
- rm -rf /work/publish
|
||||
- cd /work/netcore-repo/IRaCIS.Core.API
|
||||
- dotnet publish ./IRaCIS.Core.API.csproj -c Release --no-restore -o /work/publish
|
||||
|
||||
|
||||
- name: docker-build
|
||||
image: docker
|
||||
pull: if-not-exists
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
- name: cached_nuget_packages
|
||||
path: /drone/nuget_packages
|
||||
commands:
|
||||
- date +%H:%M:%S
|
||||
- pwd
|
||||
- docker build -t Test_Study .
|
||||
- date +%H:%M:%S
|
||||
|
||||
- name: docker-deploy
|
||||
image: docker
|
||||
pull: if-not-exists
|
||||
depends_on:
|
||||
- docker-build
|
||||
- restore-publish
|
||||
commands:
|
||||
- cd /work
|
||||
- docker build -t test-irc:v${DRONE_BUILD_NUMBER} .
|
||||
volumes:
|
||||
- name: irc-test-work
|
||||
path: /work
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- date +%H:%M:%S
|
||||
- docker rm -f test-study-container
|
||||
- docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test_Study
|
||||
- date +%H:%M:%S
|
||||
|
||||
|
||||
volumes:
|
||||
- name: cached_nuget_packages
|
||||
- name: nuget-packages
|
||||
host:
|
||||
path: /mnt/d/docker_publish/nuget_packages
|
||||
path: /opt/cicd/nuget/packages
|
||||
- name: irc-test-work
|
||||
host:
|
||||
path: /opt/cicd/irc-test
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
@ -44,63 +78,63 @@ trigger:
|
|||
- master
|
||||
|
||||
---
|
||||
|
||||
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: ssh-windows-test-study-publish
|
||||
name: ssh-linux-test-irc-publish
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
arch: amd64
|
||||
os: Linux
|
||||
arch: 386
|
||||
|
||||
clone:
|
||||
disable: true #禁用默认克隆
|
||||
|
||||
server:
|
||||
host: 123.56.94.154
|
||||
user: Administrator
|
||||
password: WHxckj2019
|
||||
user: root
|
||||
password:
|
||||
from_secret: test_ssh_pwd
|
||||
|
||||
steps:
|
||||
- name: publish-test-study
|
||||
- name: publish-test-irc
|
||||
commands:
|
||||
#拉取代码 并停止服务
|
||||
- Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait
|
||||
- cd C:\CICD\Test.Study\netcore_repo
|
||||
- dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages
|
||||
- dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API
|
||||
- Start-Service -Name "Test_Study_API"
|
||||
- echo start publish test-irc-api
|
||||
- cd /opt/1panel/hang/devops/test-irc
|
||||
- sh test-irc.sh v${DRONE_BUILD_NUMBER}
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- Test.Study
|
||||
|
||||
- Test.IRC
|
||||
|
||||
---
|
||||
|
||||
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: ssh-windows-test-irc-publish
|
||||
name: ssh-linux-test-study-publish
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
arch: amd64
|
||||
os: Linux
|
||||
arch: 386
|
||||
|
||||
clone:
|
||||
disable: true #禁用默认克隆
|
||||
|
||||
server:
|
||||
host: 123.56.94.154
|
||||
user: Administrator
|
||||
password: WHxckj2019
|
||||
user: root
|
||||
password:
|
||||
from_secret: test_ssh_pwd
|
||||
|
||||
steps:
|
||||
- name: publish-test-irc
|
||||
- name: publish-test-study
|
||||
commands:
|
||||
- Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait
|
||||
- echo start publish test-study-api
|
||||
- cd /opt/1panel/hang/devops/test-study
|
||||
- sh test-study.sh v${DRONE_BUILD_NUMBER}
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- Test.IRC
|
||||
- Test.Study
|
||||
|
||||
|
Loading…
Reference in New Issue