#!/bin/bash

cd /home/reghao/code/java/devops
commit_id=`git rev-parse HEAD | cut -c 1-8`

#docker_prefix='docker.reghao.cn/tnb'
docker_prefix='registry.cn-chengdu.aliyuncs.com/reghao/devopsweb'
mvn clean package -Dmaven.test.skip=true -am -pl web
cd /home/reghao/code/java/devops/web
docker build -t ${docker_prefix}:${commit_id} .
#docker push ${docker_prefix}:${commit_id}

cd /home/reghao/code/java/devops
docker_prefix='registry.cn-chengdu.aliyuncs.com/reghao/devopsagent'
mvn clean package -Dmaven.test.skip=true -am -pl agent
cd /home/reghao/code/java/devops/agent
docker build -t ${docker_prefix}:${commit_id} .
#docker push ${docker_prefix}:${commit_id}