定制jekins-slave-jnlp镜像封装docker和kebectl命令实现pipline

基于官方:jenkins/inbound-agent:latest

DockerHub成品:

docker pull svipghy/jenkins-jnlp-slave:v1

Dockerfile

[root@node-1 /root/jenkins] k8s-node
#cat Dockerfile
FROM jenkins/inbound-agent:latest
MAINTAINER GaoHongYu
WORKDIR /home/jenkins/agent/
USER root
ARG VERSION=4.11.2
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
RUN apt-get update   && apt-get -y install git-lfs curl fontconfig wget
RUN curl --create-dirs -fsSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar   && chmod 755 /usr/share/jenkins   && chmod 644 /usr/share/jenkins/slave.jar   && curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl   && chmod +x ./kubectl && mv kubectl /usr/local/sbin   && wget -P /tmp https://download.docker.com/linux/static/stable/x86_64/docker-18.09.3.tgz && tar -zxvf /tmp/docker-18.09.3.tgz -C /tmp   && mv /tmp/docker/* /usr/local/bin && rm -rf /tmp/* && chmod +x /usr/local/bin/*

打镜像

docker build -t svipghy/jenkins-jnlp-slave:v1 .
posted @ 2022-11-20 14:39  高宏宇  阅读(312)  评论(0编辑  收藏  举报