x
continuous-integration/drone/push Build was killed Details

IRC_NewDev
hang 2023-11-28 10:51:25 +08:00
parent 3a3212f96c
commit d16009272d
1 changed files with 58 additions and 29 deletions

View File

@ -3,45 +3,74 @@ type: docker
name: irc-netcore-api
steps:
- 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: clone-repo
image: alpine/git
volumes:
- name: irc-test-work
path: /work
commands:
- if [ ! -e /repo/.git ]; then
git clone -b main http://192.168.3.68:2000/XCKJ/irc-netcore-api.git /wrok/netcore-repo;
else
cd /wrok/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
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
depends_on:
- 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
- name: docker-deploy
image: docker
pull: if-not-exists
depends_on:
- docker-build
volumes:
- 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/f/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
trigger:
branch:
- master
- Test.IRC
---