GitLab Cl Deploy - docker build push

GitLab CI  - Jobs  - Deploy(run on success)


mvn  clean install deploy -pl ezhe-service,ezhe-wap -P www  -Dmaven.test.skip=true

ls

tempdir=`date "+%Y%m%d.%H%M%S"`

mkdir  /tmp/$tempdir/

mv ezhe-wap/target/ROOT.war   /tmp/$tempdir/

cd  /tmp/$tempdir/

#Dockerfile
echo > Dockerfile
echo 'FROM registry.gozap.com/gozap-tomcat:7-jdk'             >> Dockerfile      
echo 'MAINTAINER Gozap Tomcat'                                >> Dockerfile
echo                                                          >> Dockerfile
echo 'ENV CATALINA_HOME /home/tomcat '                        >> Dockerfile
echo 'ENV PATH $CATALINA_HOME/bin:$PATH '                     >> Dockerfile
echo 'ENV JAVA_HOME /home/jdk1.7.0_75   '                     >> Dockerfile
echo  ENV TZ \'Asia/Shanghai\'                               >> Dockerfile
echo 'ADD ./ROOT.war /home/tomcat/webapps/ '                  >> Dockerfile
echo 'RUN groupadd -r tomcat && useradd -r -g tomcat tomcat'  >> Dockerfile
echo 'WORKDIR \$CATALINA_HOME '                               >> Dockerfile
echo 'EXPOSE 8080 '                                           >> Dockerfile
echo 'CMD ["catalina.sh", "run"]'                             >> Dockerfile

cat Dockerfile

registry=registry.gozap.com
appname=m.ezhe.com
appversion=1.1.3-$tempdir
docker build -t $registry/$appname:$appversion ./
docker tag -f $registry/$appname:$appversion   $registry/$appname
docker images
docker login --username="gozap" --password="hqdGpLiYZMbvm93qupUBFT"  registry.gozap.com
docker push  $registry/$appname
docker push  $registry/$appname:$appversion

rm -rf /tmp/$tempdir/


你可能感兴趣的:(docker)