centos jenkins环境搭建[原创]

centos jenkins环境搭建

1.搭建好docker环境

详细搭建docker环境可以按以下方式进行搭建

CentOS7搭建Docker环境

2.拉取docker镜像

Dockfile内容:

FROM agoit/centos7:v1

MAINTAINER angle xiong xxadev@126.com

RUN yum install wget -y
RUN cd /opt
COPY jdk-8u40-linux-x64.rpm /opt/
COPY apache-tomcat-8.5.47.tar.gz /opt/
COPY apache-ant-1.10.0-bin.tar.gz /opt/
RUN cd /opt
RUN ls ./ && pwd
RUN tar -xvf /opt/apache-tomcat-8.5.47.tar.gz -C /opt/
RUN tar -xvf /opt/apache-ant-1.10.0-bin.tar.gz -C /opt/
RUN rpm -ivh /opt/jdk-8u40-linux-x64.rpm
ENV JAVA_HOME /usr/java/default
ENV ANT_HOME /opt/apache-ant-1.10.0
ENV CLASSPATH .:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH $JAVA_HOME/bin:$ANT_HOME/bin:$PATH
ADD jenkins.war /opt/apache-tomcat-8.5.47/webapps/
#RUN wget -P /opt/apache-tomcat-8.5.47/webapps http://mirrors.jenkins-ci.org/war/latest/jenkins.war
RUN yum install git -y
RUN chmod +x /opt/apache-tomcat-8.5.47/bin/catalina.sh
ENTRYPOINT ["/opt/apache-tomcat-8.5.47/bin/catalina.sh", "run"]
# expose  port
EXPOSE 8080

或者直接通过以下方式拉取镜像:

docker pull agoit/jenkins-centos:v1

运行docker镜像

docker run -d -p 9046:8080 --name jenkins --privileged    agoit/jenkins-centos:v1

jenkins汉化

详见

 http://agoit.com/agoit/devops/jenkins/jenkins_cn

centos jenkins环境搭建