diff --git a/.drone.yml b/.drone.yml index 5679d10..d0a1790 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,106 +2,22 @@ kind: pipeline type: docker name: master steps: - - name: restore-cache - image: meltwater/drone-cache - settings: - backend: filesystem - restore: true - cache_key: "maven" - archive_format: gzip - filesystem_cache_root: "/var/lib/cache" - mount: - - "maven" - volumes: - - name: cache - path: "/var/lib/cache" - # Do stuff.. - - name: build - image: maven:3.8-openjdk-8 - volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置 - - name: maven-build - path: /app/build # 将应用打包好的Jar和执行脚本挂载出来 - commands: - - mkdir /root/.m2 - - cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml - - sed -i 's/\\/usr\\/share\\/maven\\/ref\\/repository/\\/drone\\/src\\/maven/g' /root/.m2/settings.xml - - mvn package - - cp target/test_zabbix-0.0.1-SNAPSHOT.jar /app/build/app.jar - - cp Dockerfile /app/build/Dockerfile - - cp run.sh /app/build/run.sh - - name: rebuild-cache - image: meltwater/drone-cache - settings: - backend: filesystem - rebuild: true - cache_key: "maven" - archive_format: gzip - filesystem_cache_root: "/var/lib/cache" - mount: - - "maven" - volumes: - - name: cache - path: "/var/lib/cache" -# - name: scp files -# image: appleboy/drone-scp -# settings: -# host: 192.168.230.38 -# username: root -# password: -# from_secret: macro3_psw -# port: 22 -# target: /data/wwwroot/zabbix_back -# source: /app/build/* - - name: ssh - image: appleboy/drone-ssh - settings: - host: 192.168.230.16 - username: root - password: Macro3 - port: 22 - command_timeout: 5m - script: - - cd /data/wwwroot/zabbix_back # 进入宿主机构建目录 - - chmod +x run.sh # 更改为可执行脚本 - - ./run.sh # 运行脚本打包应用镜像并运行 -# - name: docker -# image: plugins/docker -# settings: -# dockerfile: "Dockerfile" -# username: -# from_secret: docker_username -# password: -# from_secret: docker_password -# tags: -# - master -# - name: notify -# pull: if-not-exists # 如果镜像不存在则拉取,免去每次都要重新下载 -# image: drillster/drone-email -# settings: -# recipients_only: true # 只发送给指定邮件收件人,不默认发送给流水线创建人 -# host: smtp.163.com #SMTP服务器 例如 smtp.qq.com -# port: 465 #SMTP服务端口 例如QQ邮箱端口465 -# subject: "Drone Build Complete!" # 邮件主题内容 -# username: #邮箱用户名 -# from_secret: mail_user -# password: #邮箱密码 -# from_secret: mail_secret -# from: -# from_secret: mail_username -# recipients: #收件人 -# from_secret: mail_recipients # 格式:xxxx,xxxx -# when: #执行条件 -# status: -# - success -# - changed -# - failure -volumes: # 定义流水线挂载目录,用于共享数据 - - name: maven-build - host: - path: /data/wwwroot/zabbix_back # 从宿主机中挂载的目录 - - name: cache - host: - path: "/var/lib/cache" + - name: build + image: maven:3.8-openjdk-8 + commands: + - mvn clean package + + - name: build-docker-image + image: plugins/docker + settings: + repo: 192.168.230.38:8888/zabbix/back:latest + registry: 192.168.230.38:8888 + username: + from_secret: harbor_user + password: + from_secret: harbor_psw + dockerfile: Dockerfile + tags: latest trigger: branch: - master diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index ba574a0..a083324 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -4,7 +4,8 @@ server: spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://zabbix-mysql/zabbix?useSSL=false + # url: jdbc:mysql://zabbix-mysql/zabbix?useSSL=false + url: jdbc:mysql://192.168.230.16:3308/zabbix?useSSL=false username: root password: zabbix123. hikari: