From 1480dd81ebad710017cd2e4eea8fd41a04291717 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 12 Nov 2018 20:11:59 -0800 Subject: [PATCH] Migrate CI images to tagged Ubuntu release Update the CI image process to build from a tagged ubuntu release. All images now make use of a shared setup script to install the appropriate binaries. Closes gh-15158 --- ci/images/README.adoc | 21 +++++++ ci/images/setup.sh | 56 +++++++++++++++++++ ci/images/spring-boot-ci-image/Dockerfile | 37 ++---------- .../spring-boot-jdk10-ci-image/Dockerfile | 37 ++---------- .../spring-boot-jdk9-ci-image/Dockerfile | 37 ++---------- 5 files changed, 95 insertions(+), 93 deletions(-) create mode 100644 ci/images/README.adoc create mode 100755 ci/images/setup.sh diff --git a/ci/images/README.adoc b/ci/images/README.adoc new file mode 100644 index 00000000000..84eae1609ed --- /dev/null +++ b/ci/images/README.adoc @@ -0,0 +1,21 @@ +== CI Images + +These images are used by CI to run the actual builds. + +To build the image locally run the following from this directory: + +---- +$ docker build --no-cache -f /Dockerfile . +---- + +For example + +---- +$ docker build --no-cache -f spring-boot-ci-image/Dockerfile . +---- + +To test run: + +---- +$ docker run -it --entrypoint /bin/bash ✈ +---- diff --git a/ci/images/setup.sh b/ci/images/setup.sh new file mode 100755 index 00000000000..0b713baf2ce --- /dev/null +++ b/ci/images/setup.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -ex + +########################################################### +# UTILS +########################################################### + +apt-get update +apt-get install --no-install-recommends -y ca-certificates net-tools libxml2-utils git curl libudev1 libxml2-utils iptables jq +rm -rf /var/lib/apt/lists/* + +curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.2/concourse-java.sh > /opt/concourse-java.sh + + +########################################################### +# JAVA +########################################################### + +case "$1" in + java8) + JDK_URL=https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/openjdk-1.8.0_192.tar.gz + ;; + java9) + JDK_URL=https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz + ;; + java10) + JDK_URL=https://download.java.net/java/GA/jdk10/10.0.1/fb4372174a714e6b8c52526dc134031e/10/openjdk-10.0.1_linux-x64_bin.tar.gz + ;; + jav11) + JDK_URL=https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/openjdk-11.0.1_13.tar.gz + ;; + *) + echo $"Unknown java version" + exit 1 +esac +mkdir -p /opt/openjdk +cd /opt/openjdk +curl ${JDK_URL} | tar xz + + +########################################################### +# DOCKER +########################################################### + +cd / +curl https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz | tar zx +mv /docker/* /bin/ +chmod +x /bin/docker* + +export ENTRYKIT_VERSION=0.4.0 +curl -L https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz | tar zx +chmod +x entrykit && \ +mv entrykit /bin/entrykit && \ +entrykit --symlink + +curl https://raw.githubusercontent.com/concourse/docker-image-resource/v1.0.0/assets/common.sh > /docker-lib.sh diff --git a/ci/images/spring-boot-ci-image/Dockerfile b/ci/images/spring-boot-ci-image/Dockerfile index bbeb3927aef..51557fad0f5 100644 --- a/ci/images/spring-boot-ci-image/Dockerfile +++ b/ci/images/spring-boot-ci-image/Dockerfile @@ -1,34 +1,9 @@ -# 1.8.0_181-8u181-b13-1~deb9u1-b13 -FROM openjdk@sha256:1b842a215cf3437c9197f0f47e5c1a12f0a27aed27b84536ee3d8ef6b9b7e19e +FROM ubuntu:bionic-20181018 -RUN apt-get update && \ - apt-get install -y git && \ - apt-get install -y libxml2-utils && \ - apt-get install -y jq +ADD setup.sh /setup.sh +RUN ./setup.sh java8 -ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.2/concourse-java.sh /opt/ +ENV JAVA_HOME /opt/openjdk +ENV PATH $JAVA_HOME/bin:$PATH -ENV DOCKER_VERSION=17.05.0-ce \ - ENTRYKIT_VERSION=0.4.0 - -RUN apt-get update && \ - apt-get install -y curl && \ - apt-get install -y libudev1 && \ - apt-get install -y iptables && \ - curl https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz | tar zx && \ - mv /docker/* /bin/ && chmod +x /bin/docker* - -# Install entrykit -RUN curl -L https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz | tar zx && \ - chmod +x entrykit && \ - mv entrykit /bin/entrykit && \ - entrykit --symlink - -ADD docker-lib.sh /docker-lib.sh - -ENTRYPOINT [ \ - "switch", \ - "shell=/bin/sh", "--", \ - "codep", \ - "/bin/docker daemon" \ -] \ No newline at end of file +ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ] diff --git a/ci/images/spring-boot-jdk10-ci-image/Dockerfile b/ci/images/spring-boot-jdk10-ci-image/Dockerfile index 719a13deaf6..e96eb65961a 100644 --- a/ci/images/spring-boot-jdk10-ci-image/Dockerfile +++ b/ci/images/spring-boot-jdk10-ci-image/Dockerfile @@ -1,34 +1,9 @@ -# 10.0.2+13-Debian-1 -FROM openjdk@sha256:d1bd71b98701c94a7041c328259a8645f02e965b91ead8125d4ca39e068334fb +FROM ubuntu:bionic-20181018 -RUN apt-get update && \ - apt-get install -y git && \ - apt-get install -y libxml2-utils && \ - apt-get install -y jq +ADD setup.sh /setup.sh +RUN ./setup.sh java10 -ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.2/concourse-java.sh /opt/ +ENV JAVA_HOME /opt/openjdk +ENV PATH $JAVA_HOME/bin:$PATH -ENV DOCKER_VERSION=17.05.0-ce \ - ENTRYKIT_VERSION=0.4.0 - -RUN apt-get update && \ - apt-get install -y curl && \ - apt-get install -y libudev1 && \ - apt-get install -y iptables && \ - curl https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz | tar zx && \ - mv /docker/* /bin/ && chmod +x /bin/docker* - -# Install entrykit -RUN curl -L https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz | tar zx && \ - chmod +x entrykit && \ - mv entrykit /bin/entrykit && \ - entrykit --symlink - -ADD docker-lib.sh /docker-lib.sh - -ENTRYPOINT [ \ - "switch", \ - "shell=/bin/sh", "--", \ - "codep", \ - "/bin/docker daemon" \ -] \ No newline at end of file +ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ] diff --git a/ci/images/spring-boot-jdk9-ci-image/Dockerfile b/ci/images/spring-boot-jdk9-ci-image/Dockerfile index d56ba5433e0..b1a23e2560d 100644 --- a/ci/images/spring-boot-jdk9-ci-image/Dockerfile +++ b/ci/images/spring-boot-jdk9-ci-image/Dockerfile @@ -1,34 +1,9 @@ -# 9.0.4+12-Debian-4 -FROM openjdk@sha256:0e48e7e79d9e5637ee5d9c4a4fa2615c7bde69390aab06f7105eb4a8ebec8383 +FROM ubuntu:bionic-20181018 -RUN apt-get update && \ - apt-get install -y git && \ - apt-get install -y libxml2-utils && \ - apt-get install -y jq +ADD setup.sh /setup.sh +RUN ./setup.sh java9 -ADD https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.2/concourse-java.sh /opt/ +ENV JAVA_HOME /opt/openjdk +ENV PATH $JAVA_HOME/bin:$PATH -ENV DOCKER_VERSION=17.05.0-ce \ - ENTRYKIT_VERSION=0.4.0 - -RUN apt-get update && \ - apt-get install -y curl && \ - apt-get install -y libudev1 && \ - apt-get install -y iptables && \ - curl https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz | tar zx && \ - mv /docker/* /bin/ && chmod +x /bin/docker* - -# Install entrykit -RUN curl -L https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz | tar zx && \ - chmod +x entrykit && \ - mv entrykit /bin/entrykit && \ - entrykit --symlink - -ADD docker-lib.sh /docker-lib.sh - -ENTRYPOINT [ \ - "switch", \ - "shell=/bin/sh", "--", \ - "codep", \ - "/bin/docker daemon" \ -] \ No newline at end of file +ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ]