Skip to content

Commit

Permalink
Merge pull request #321 from dduportal/feat/add-curl
Browse files Browse the repository at this point in the history
feat(linux) add curl
  • Loading branch information
dduportal authored Nov 12, 2022
2 parents a096c55 + dda0e6d commit 70c7dba
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 32 deletions.
13 changes: 5 additions & 8 deletions 11/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
ARG JAVA_VERSION=11.0.17_8
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine

ARG VERSION=3071.v7e9b_0dc08466
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
Expand All @@ -32,21 +31,19 @@ ARG gid=1000
RUN addgroup -g "${gid}" "${group}" \
&& adduser -h /home/"${user}" -u "${uid}" -G "${group}" -D "${user}"

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

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

## Always use the latest Alpine packages: no need for versions
# hadolint ignore=DL3018
RUN apk add --no-cache curl bash git git-lfs musl-locales openssh-client openssl procps \
&& 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 \
&& apk del --purge curl \
&& rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*

ARG VERSION=3071.v7e9b_0dc08466
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

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

Expand Down
10 changes: 4 additions & 6 deletions 11/archlinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ RUN jlink \

FROM archlinux:base-20221106.0.100148

ARG VERSION=3071.v7e9b_0dc08466
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
Expand All @@ -47,12 +46,11 @@ RUN groupadd -g "${gid}" "${group}" \

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

RUN pacman -Syu git git-lfs --noconfirm
RUN pacman -Syu curl git git-lfs --noconfirm

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
ARG VERSION=3071.v7e9b_0dc08466
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
Expand Down
10 changes: 4 additions & 6 deletions 11/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ RUN jlink \

FROM debian:bullseye-20221024

ARG VERSION=3071.v7e9b_0dc08466
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
Expand All @@ -55,13 +54,12 @@ RUN apt-get update \
curl \
ca-certificates \
fontconfig \
&& 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 \
&& apt-get remove -y curl \
&& rm -rf /var/lib/apt/lists/*

ARG VERSION=3071.v7e9b_0dc08466
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

ENV LANG C.UTF-8

ENV JAVA_HOME=/opt/java/openjdk
Expand Down
10 changes: 4 additions & 6 deletions 17/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
ARG JAVA_VERSION=17.0.5_8
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine

ARG VERSION=3071.v7e9b_0dc08466
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
Expand All @@ -38,13 +37,12 @@ ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
## Always use the latest Alpine packages: no need for versions
# hadolint ignore=DL3018
RUN apk add --no-cache curl bash git git-lfs musl-locales openssh-client openssl procps \
&& 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 \
&& apk del --purge curl \
&& rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*

ARG VERSION=3071.v7e9b_0dc08466
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN 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}"
Expand Down
9 changes: 4 additions & 5 deletions 17/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ RUN apt-get update \
curl \
ca-certificates \
fontconfig \
&& 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 \
&& apt-get remove -y curl \
&& rm -rf /var/lib/apt/lists/*

ARG VERSION=3071.v7e9b_0dc08466
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

ENV LANG C.UTF-8

ENV JAVA_HOME=/opt/java/openjdk
Expand Down
8 changes: 7 additions & 1 deletion tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ARCH=${ARCH:-x86_64}
assert_equal "${output}" "UTF-8"
}

@test "[${SUT_IMAGE}] image has bash and java installed and in the PATH" {
@test "[${SUT_IMAGE}] image has bash, curl and java installed and in the PATH" {
local cid
cid="$(docker run -d -it -P "${SUT_IMAGE}" /bin/bash)"

Expand All @@ -42,6 +42,12 @@ ARCH=${ARCH:-x86_64}
assert_success
run docker exec "${cid}" bash --version
assert_success

run docker exec "${cid}" sh -c "command -v curl"
assert_success
run docker exec "${cid}" sh -c "curl --version"
assert_success

run docker exec "${cid}" sh -c "command -v java"
assert_success

Expand Down

0 comments on commit 70c7dba

Please sign in to comment.