Base Images

Java Open JDK Images

We generally cycle through our JDK images more frequently based on the various versions we need for infrastructure applications and our own apps. For this lab we will be leveraging two additional JDKs.

labimagesopenjdk-11
version: '3.8'

services:
  openjdk-11:
    image: infra/java/openjdk-11:1.0.0
    build:
      context: .
      network: host
      args:
        ARG_ART_URL: http://d1i-doc-ngbuild:3001
      extra_hosts:
        - "d1i-doc-ngbuild:172.22.90.2"
FROM infra/ubuntu/focal:1.0.0

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

ARG ARG_ART_URL

RUN sed -e "s|APT_URL|${ARG_ART_URL}|" /etc/apt/sources.list.base > /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y --no-install-recommends tzdata curl ca-certificates fontconfig locales \
    && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
    && locale-gen en_US.UTF-8 \
    && rm -rf /var/lib/apt/lists/* \
    && rm /etc/apt/sources.list

ENV JAVA_VERSION jdk-11.0.11+9

#RUN set -eux; \
RUN set -eu; \
    curl $ARG_ART_URL/repository/dml/docker/jdk/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz -o /tmp/openjdk.tar.gz; \
    mkdir -p /opt/java/openjdk; \
    cd /opt/java/openjdk; \
    tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
    rm -rf /tmp/openjdk.tar.gz;

ENV JAVA_HOME=/opt/java/openjdk \
    PATH="/opt/java/openjdk/bin:$PATH"
CMD ["jshell"]
labimagesopenjdk-12
version: '3.3'

services:
  openjdk-12:
    image: infra/java/openjdk-12:1.0.0
    build:
      context: .
      network: host
      args:
        ARG_ART_URL: http://d1i-doc-ngbuild:3001
      extra_hosts:
        - "d1i-doc-ngbuild:172.22.90.2"
FROM infra/ubuntu/focal:1.0.0

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

ARG ARG_ART_URL

RUN sed -e "s|APT_URL|${ARG_ART_URL}|" /etc/apt/sources.list.base > /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y --no-install-recommends curl ca-certificates locales \
    && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
    && locale-gen en_US.UTF-8 \
    && rm -rf /var/lib/apt/lists/* \
    && rm /etc/apt/sources.list

ENV JAVA_VERSION jdk-12.0.2+10

#RUN set -eux; \
RUN set -eu; \
    curl $ARG_ART_URL/repository/dml/docker/jdk/jdk-12.0.2+10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz -o /tmp/openjdk.tar.gz; \
    mkdir -p /opt/java/openjdk; \
    cd /opt/java/openjdk; \
    tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
    rm -rf /tmp/openjdk.tar.gz;

ENV JAVA_HOME=/opt/java/openjdk \
    PATH="/opt/java/openjdk/bin:$PATH"
CMD ["jshell"]

Build them via their respective compose files and then publish.

docker-compose -f images/openjdk-11/docker-compose.yml build
docker-compose -f images/openjdk-12/docker-compose.yml build

#docker login docker-private.acme.com
images/docker-push.sh infra/java/openjdk-11:1.0.0 docker-private.acme.com
images/docker-push.sh infra/java/openjdk-12:1.0.0 docker-private.acme.com