Merge branch 'master' of http://101.43.112.107:3000/root/allLikeMall into HEAD
This commit is contained in:
commit
65827a624b
98
.drone.yml
Normal file
98
.drone.yml
Normal file
@ -0,0 +1,98 @@
|
||||
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
||||
|
||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||
|
||||
name: filesystem-drone # 定义流水线名称
|
||||
|
||||
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
|
||||
- name: package # 流水线名称
|
||||
|
||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
||||
|
||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
||||
|
||||
- name: maven-cache
|
||||
|
||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
||||
|
||||
- name: maven-build
|
||||
|
||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
||||
|
||||
commands: # 定义在Docker容器中执行的shell命令
|
||||
|
||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
||||
|
||||
# - cd yudao-server/target/
|
||||
# - ls
|
||||
|
||||
- cp yudao-server/target/yudao-server.jar /app/build/yudao-server.jar
|
||||
|
||||
- cp yudao-server/Dockerfile /app/build/Dockerfile
|
||||
|
||||
- cp yudao-server/run.sh /app/build/run.sh
|
||||
|
||||
|
||||
|
||||
- name: copy package
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 101.43.112.107 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 5m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
# - 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: 5m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
# - ls
|
||||
- cd /zymail/build
|
||||
- chmod +x run.sh # 更改为可执行脚本
|
||||
- ./run.sh # 运行脚本打包应用镜像并运行
|
||||
|
||||
volumes: # 定义流水线挂载目录,用于共享数据
|
||||
|
||||
- name: maven-build
|
||||
host:
|
||||
path: /zymail/maven/build # 从宿主机中挂载的目录
|
||||
|
||||
- name: maven-cache
|
||||
host:
|
||||
path: /zymail/maven/cache # 从宿主机中挂载的目录
|
40
pom.xml
40
pom.xml
@ -131,35 +131,29 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- 使用 huawei / aliyun 的 Maven 源,提升下载速度 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>huaweicloud</id>
|
||||
<name>huawei</name>
|
||||
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyunmaven</id>
|
||||
<name>aliyun</name>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
|
@ -1,12 +1,10 @@
|
||||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||
## 感谢复旦核博士的建议!灰子哥,牛皮!
|
||||
FROM eclipse-temurin:8-jre
|
||||
FROM openjdk:8-jre
|
||||
|
||||
## 创建目录,并使用它作为工作目录
|
||||
RUN mkdir -p /yudao-server
|
||||
WORKDIR /yudao-server
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ./target/yudao-server.jar app.jar
|
||||
ADD yudao-server.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
16
yudao-server/run.sh
Normal file
16
yudao-server/run.sh
Normal file
@ -0,0 +1,16 @@
|
||||
app_name='zymall'
|
||||
# 定义应用版本
|
||||
app_version='1.0.0'
|
||||
# 定义应用环境
|
||||
#profile_active='prod'
|
||||
echo '----stop container----'
|
||||
docker stop ${app_name}
|
||||
echo '----rm container----'
|
||||
docker rm ${app_name}
|
||||
#echo '----rm image----'
|
||||
#docker rmi ${group_name}/${app_name}:${app_version}
|
||||
# 打包编译docker镜像
|
||||
echo '----build image----'
|
||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||
echo '----start container----'
|
||||
docker run -d -p 6127:6127 --name ${app_name} ${app_name}:${app_version}
|
Loading…
Reference in New Issue
Block a user