Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide image which is based on Debian 10/buster #106

Merged
merged 1 commit into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 50 additions & 0 deletions Dockerfile-jdk11-buster
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# The MIT License
#
# Copyright (c) 2015-2020, CloudBees, Inc. and other Jenkins contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

FROM openjdk:11-jdk-buster
MAINTAINER Oleg Nenashev <o.v.nenashev@gmail.com>

ARG VERSION=4.0.1
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000

RUN groupadd -g ${gid} ${group}
RUN useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -m ${user}
LABEL Description="This is a base image, which provides the Jenkins agent executable (slave.jar)" Vendor="Jenkins project" Version="${VERSION}"

ARG AGENT_WORKDIR=/home/${user}/agent

RUN apt-get update && apt-get install git-lfs && rm -rf /var/lib/apt/lists/*
RUN curl --create-dirs -fsSLo /usr/share/jenkins/agent.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/agent.jar \
&& ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

USER ${user}
ENV AGENT_WORKDIR=${AGENT_WORKDIR}
RUN mkdir /home/${user}/.jenkins && mkdir -p ${AGENT_WORKDIR}

VOLUME /home/${user}/.jenkins
VOLUME ${AGENT_WORKDIR}
WORKDIR /home/${user}
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IMAGE_NAME:=jenkins4eval/slave
IMAGE_NAME_AGENT:=jenkins4eval/agent

.PHONY: build
build: build-alpine build-debian build-jdk11
build: build-alpine build-debian build-jdk11 build-jdk11-buster

build-alpine:
docker build -t ${IMAGE_NAME}:alpine -t ${IMAGE_NAME_AGENT}:alpine --file Dockerfile-alpine .
Expand All @@ -13,7 +13,10 @@ build-debian:
docker build -t ${IMAGE_NAME}:test -t ${IMAGE_NAME_AGENT}:test --file Dockerfile .

build-jdk11:
docker build -t ${IMAGE_NAME}:jdk11 -t ${IMAGE_NAME_AGENT}:jdk11 --file Dockerfile-jdk11 .
docker build -t ${IMAGE_NAME}:jdk11 -t ${IMAGE_NAME_AGENT}:jdk11 --file Dockerfile-jdk11 .

build-jdk11-buster:
docker build -t ${IMAGE_NAME}:jdk11-buster -t ${IMAGE_NAME_AGENT}:jdk11-buster --file Dockerfile-jdk11-buster .


bats:
Expand All @@ -22,7 +25,7 @@ bats:
@git -C bats-core reset --hard c706d1470dd1376687776bbe985ac22d09780327

.PHONY: test
test: test-alpine test-debian test-jdk11
test: test-alpine test-debian test-jdk11 test-jdk11-buster

.PHONY: test-alpine
test-alpine: bats
Expand All @@ -35,3 +38,7 @@ test-debian: bats
.PHONY: test-jdk11
test-jdk11: bats
@FLAVOR=jdk11 bats-core/bin/bats tests/tests.bats

.PHONY: test-jdk11-buster
test-jdk11-buster: bats
@FLAVOR=jdk11-buster bats-core/bin/bats tests/tests.bats
6 changes: 6 additions & 0 deletions tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ then
JDK=11
AGENT_IMAGE+=":jdk11"
AGENT_CONTAINER+="-jdk11"
elif [[ "${FLAVOR}" = "jdk11-buster" ]]
then
DOCKERFILE+="-jdk11-buster"
JDK=11
AGENT_IMAGE+=":jdk11-buster"
AGENT_CONTAINER+="-jdk11-buster"
else
DOCKERFILE+="-alpine"
AGENT_IMAGE+=":alpine"
Expand Down