-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.travis.yml
21 lines (21 loc) · 974 Bytes
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
language: java
services:
- docker
sudo: required
branches:
only:
- master
#使用ssh登陆的时候会确认主机信息,travis-ci自动化运行无法进行交互操作,所以在.travis.yml中添加以下内容跳过确认
addons:
ssh_known_hosts: $server_ip
before_install:
- openssl aes-256-cbc -K $encrypted_d51746e9182b_key -iv $encrypted_d51746e9182b_iv
-in nopwd.enc -out ~/.ssh/nopwd -d
script:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- docker build -t registry.cn-hangzhou.aliyuncs.com/jafir_docker_images/jafir-images:latest .
after_success:
- docker login --username=jafir@1866908499405822 -p=$aliyun_pwd registry.cn-hangzhou.aliyuncs.com
- docker push registry.cn-hangzhou.aliyuncs.com/jafir_docker_images/jafir-images:latest
- chmod 600 ~/.ssh/nopwd
- ssh -o "StrictHostKeyChecking no" -i ~/.ssh/nopwd root@$server_ip "cd /mydockerdata;docker-compose -f docker-compose.yml pull;docker-compose -f docker-compose.yml up -d;exit"