Jenkins构建-docker

12 篇文章 0 订阅

Jenkins构建 Dockerfile

# Docker for CentOS 7

#Base image
FROM hfq/centos7:Jurassic

#http://mirrors.jenkins-ci.org/war/latest/jenkins.war
#https://pkg.jenkins.io/redhat-stable/

ADD supervisord.conf /etc/supervisord.conf


#安装supervisor=============================重点=================================
RUN yum -y install python-setuptools
RUN easy_install supervisor


ARG jenkins_home=/var/lib/jenkins
ARG user=root
#ARG user=jenkins
#ARG group=jenkins
#ARG uid=1000
#ARG gid=1000


ENV JENKINS_HOME ${jenkins_home}
ENV JENKINS_USER ${user}

#RUN groupadd -g ${gid} ${group} && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}

RUN \
    wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo \
    && rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key \
    && yum -y install jenkins

#创建的挂载点
VOLUME ["/shimanqiang","/weijianglong","/wangxin","/zhangfengchao","/zangxufeng","/liqiang"]
#VOLUME ${jenkins_home}


USER ${user}

EXPOSE 8080

CMD /usr/bin/supervisord -c /etc/supervisord.conf


###############################################构建脚本####################################
#构建image镜像
#docker build -t hfq/centos7:Jenkins .
#docker build -t hfq/jenkins:v1 .

#启动container后台运行提供sshd服务
#docker run -d -P --name <container name> hfq/centos7:Jenkins


#进入sshd启动的container
#docker exec -it <container name or id> /bin/bash

#docker rm $(docker ps -a | grep "xxx/jedi:v5" | awk '{print $1}')

#操作记录
#docker run -d -p 9090:8080 -P --name hfq-jedi-Jenkins hfq/centos7:Jenkins
#http://47.93.114.117:9090
#docker run -d -p 9091:8080 -P --name JenkinsV1 hfq/jenkins:v1

supervisord.conf

[supervisord]
nodaemon=true

[program:sshd]
command=/usr/sbin/sshd -D
autostart=true
autorestart=true

[program:jenkins]
command=nohup java -jar /usr/lib/jenkins/jenkins.war &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值