Compare commits

..

No commits in common. "a6a1ab163d2a81fc4c8bf6768da9bfe0a782be63" and "3eead082f8464c5523ee431c3a313930ece7013a" have entirely different histories.

4 changed files with 43 additions and 97 deletions

View File

@ -1,69 +0,0 @@
kind: pipeline # 定义对象类型还有secret和signature两种类型
type: docker # 定义流水线类型还有kubernetes、exec、ssh等类型
name: filesystem-drone # 定义流水线名称
clone:
disable: true
steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: package-and-push-image
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 101.43.112.107 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 10m # 远程执行命令超时时间
script:
- cd /root/allLikeMall
- git fetch origin
- git reset --hard origin/master
- git clean -fd
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
- cd yudao-server
- chmod +x push.sh
- ./push.sh
- scp run.sh root@1.14.205.126:/zymail/build
# - ls
# - scp -r /zymail/maven/build root@1.14.205.126:/zymail
# - ssh root@1.14.205.126
# - ls
# - chmod +x run.sh # 更改为可执行脚本
# - ./run.sh # 运行脚本打包应用镜像并运行
- name: build-start
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 1.14.205.126 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 30m # 远程执行命令超时时间
script:
# - ls
- cd /zymail/build
- chmod +x run.sh # 更改为可执行脚本
- ./run.sh # 运行脚本打包应用镜像并运行

View File

@ -8,6 +8,42 @@ clone:
disable: true
steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: package-and-push-image
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 101.43.112.107 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 10m # 远程执行命令超时时间
script:
- cd /root/allLikeMall
- git fetch origin
- git reset --hard origin/master
- git clean -fd
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
- cd yudao-server
- chmod +x push.sh
- ./push.sh
- scp run.sh root@1.14.205.126:/zymail/build
# - ls
# - scp -r /zymail/maven/build root@1.14.205.126:/zymail
# - ssh root@1.14.205.126
# - ls
# - chmod +x run.sh # 更改为可执行脚本
# - ./run.sh # 运行脚本打包应用镜像并运行
- name: build-start
image: appleboy/drone-ssh # SSH工具镜像
@ -27,12 +63,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
command_timeout: 30m # 远程执行命令超时时间
script:
- cd /root/allLikeMall
- git fetch origin
- git reset --hard origin/master
- git clean -fd
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
- cd yudao-server
- chmod +x all.sh
- ./all.sh
# - ls
- cd /zymail/build
- chmod +x run.sh # 更改为可执行脚本
- ./run.sh # 运行脚本打包应用镜像并运行

View File

@ -1,16 +0,0 @@
#!/bin/bash
app_name='zymall'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t "${app_name}:${app_version}" .
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----start container----'
docker run -d -p 6127:6127 --name ${app_name} -v /home/mallpic:/home/mallpic --restart always ${app_name}:${app_version}

View File

@ -10,7 +10,7 @@ echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
#echo '----rm image----'
#docker rmi -f "${app_name}:${app_version}"
echo '----start container----'
docker run -d -p 6127:6127 --name ${app_name} -v /home/mallpic:/home/mallpic --restart always "${app_repository}/${app_name}:${app_version}"
docker run -d -p 6127:6127 --name ${app_name} --restart always "${app_repository}/${app_name}:${app_version}"