Dockerfile 配置

[root@bidocker01-ctc-bj-10-254-64-240 mkdocker-dmp-api]# cat Dockerfile 
#Dockerfile
FROM ubuntu
MAINTAINER wangpenga@chunbo.com
#更新apt-get源 使用aliyun的源
RUN     mv /etc/apt/sources.list /etc/apt/sources.list.bak 
RUN     echo "deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe " >/etc/apt/sources.list
RUN     echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe " >>/etc/apt/sources.list
RUN     echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe " >>/etc/apt/sources.list

RUN apt-get update && apt-get install net-tools
RUN apt-get update && apt-get install vim rsync  wget  curl lrzsz openssh-client -y
RUN echo "Asia/Shanghai" >  /etc/timezone

ADD data/jdk1.8.0_92  /usr/java/
RUN  cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'export JAVA_HOME=/usr/java '>> /etc/profile 
RUN echo 'export PATH=$JAVA_HOME/bin:$PATH ' >> /etc/profile
ADD data/bi-finagle /root/bi-finagle
CMD cd /root/bi-finagle/bin/ ; ./dockerstart.sh
[root@bidocker01-ctc-bj-10-254-64-240 mkdocker-dmp-api]# 

下面的是docker打包程序脚本


[root@bidocker01-ctc-bj-10-254-64-240 mkdocker-dmp-api]# cat MakeDockerImage.sh 
cd `dirname $0`
pwd
VersionID=$1

imageaddr="dregistry.prod.chunbo.com/biprod/dmp-api"


if [ ! $1 ]; then  
  echo "VersionID IS NULL"  
  echo -n "Enter a VersionID: "
  read VersionID
else  
  echo "VersionID=${VersionID}"  
fi  

sudo docker build -t ${imageaddr}:${VersionID}  .
[ $? == 0 ] && echo "build docker image is successful." || exit 1

sudo docker push  ${imageaddr}:${VersionID}
[ $? == 0 ] && echo "push docker image is successful." || exit 1
[root@bidocker01-ctc-bj-10-254-64-240 mkdocker-dmp-api]# 
文档更新时间: 2020-01-26 08:10   作者:月影鹏鹏