Compare commits
4 Commits
3eead082f8
...
a6a1ab163d
Author | SHA1 | Date | |
---|---|---|---|
a6a1ab163d | |||
9860ff79d5 | |||
8b801be4f3 | |||
df69d98073 |
69
.drone-build-image.yml
Normal file
69
.drone-build-image.yml
Normal file
@ -0,0 +1,69 @@
|
||||
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 # 运行脚本打包应用镜像并运行
|
49
.drone.yml
49
.drone.yml
@ -8,42 +8,6 @@ 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工具镜像
|
||||
@ -63,7 +27,12 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
command_timeout: 30m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
# - ls
|
||||
- cd /zymail/build
|
||||
- chmod +x run.sh # 更改为可执行脚本
|
||||
- ./run.sh # 运行脚本打包应用镜像并运行
|
||||
- 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
|
||||
|
||||
|
16
yudao-server/all.sh
Normal file
16
yudao-server/all.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/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}
|
@ -10,7 +10,7 @@ echo '----stop container----'
|
||||
docker stop ${app_name}
|
||||
echo '----rm container----'
|
||||
docker rm ${app_name}
|
||||
#echo '----rm image----'
|
||||
#docker rmi -f "${app_name}:${app_version}"
|
||||
echo '----rmi none image----'
|
||||
docker rmi $(docker images -f "dangling=true" -q)
|
||||
echo '----start container----'
|
||||
docker run -d -p 6127:6127 --name ${app_name} --restart always "${app_repository}/${app_name}:${app_version}"
|
||||
docker run -d -p 6127:6127 --name ${app_name} -v /home/mallpic:/home/mallpic --restart always "${app_repository}/${app_name}:${app_version}"
|
Loading…
Reference in New Issue
Block a user