Dockerfiles/jenkins.dockerfile
2022-12-09 13:49:27 +08:00

54 lines
2.3 KiB
Docker

FROM registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:latest
LABEL maintainer 168062547@qq.com
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
# ARG http_port=8080
# ARG agent_port=50000
ENV JENKINS_HOME /var/jenkins_home
ENV JENKINS_SLAVE_AGENT_PORT ${agent_port}
RUN groupadd -g ${gid} ${group} \
&& useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}
RUN chown -R ${user} "$JENKINS_HOME"
RUN curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
RUN echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update
RUN apt-get install -y jenkins openjdk-11-jre docker-ce-cli python2
ENV TINI_VERSION 0.19.0
ENV TINI_SHA c5b0666b4cb676901f90dfcb37106783c5fe2077b04590973b885950611b30ee
# Use tini as subreaper in Docker container to adopt zombie processes
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /sbin/tini && chmod +x /sbin/tini \
&& echo "$TINI_SHA /sbin/tini" | sha256sum -c -
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
RUN python2 ./get-pip.py
RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
RUN pip2 install pyyaml python-jenkins -i https://mirrors.aliyun.com/pypi/simple/
VOLUME /var/jenkins_home
USER ${user}
ENTRYPOINT ["/sbin/tini", "--", "jenkins"]
# docker build -t jl_jenkins .
# docker run -p 8080:8080 -p 50000:50000 --rm -d --volume jenkins-data:/var/jenkins_home registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins
# docker tag d97263da6c6f registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins
# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins
# docker run --rm -it registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:latest