Skip to content

Commit

Permalink
Changed dockerfiles to use adoptium JDK for CentOS 7, Alpine 3.15 and…
Browse files Browse the repository at this point in the history
… Ubuntu 20.04
  • Loading branch information
gershom96 committed Mar 10, 2022
1 parent 68f92ec commit 0d15212
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project 5.9.x per each release will be documented in

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [v5.9.0.5] - 2022-03-09

### Added
-Changed base image of dockerfiles to an OS image and installed relevant JDK on it, instead of using a JDK installed OS image.

## [v5.9.0.4] - 2020-11-25

### Added
Expand Down Expand Up @@ -34,5 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
For detailed information on the tasks carried out during this release, please see the GitHub milestone
[v5.9.0.1](https://github.com/wso2/docker-is/milestone/8).

[v5.9.0.2]: https://github.com/wso2/docker-is/compare/v5.9.0.1...v5.9.0.2
[v5.9.0.3]: https://github.com/wso2/docker-is/compare/v5.9.0.2...v5.9.0.3
[v5.9.0.4]: https://github.com/wso2/docker-is/compare/v5.9.0.3...v5.9.0.4
[v5.9.0.5]: https://github.com/wso2/docker-is/compare/v5.9.0.4...v5.9.0.5
64 changes: 60 additions & 4 deletions dockerfiles/alpine/is/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,58 @@
#
# ------------------------------------------------------------------------

# set base Docker image to AdoptOpenJDK Alpine Docker image
FROM adoptopenjdk/openjdk8:jdk8u222-b10-alpine
# Set base Docker image to Alpine Docker image.
FROM alpine:3.15.0
LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.5"
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# Install JDK Dependencies.
RUN apk add --no-cache tzdata musl-locales musl-locales-lang \
&& rm -rf /var/cache/apk/*

ENV JAVA_VERSION jdk8u322-b06

RUN apk --no-progress --purge --no-cache upgrade \
&& apk --no-progress --purge --no-cache add --upgrade \
curl \
wget \
openssh \
&& apk --no-progress --purge --no-cache upgrade \
&& rm -vrf /var/cache/apk/* \
&& curl --version

RUN curl -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& curl -LO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk \
&& apk add glibc-2.32-r0.apk

#Install JDK8.
RUN set -eux; \
apk add --no-cache --virtual .fetch-deps curl; \
ARCH="$(apk --print-arch)"; \
case "${ARCH}" in \
amd64|x86_64) \
ESUM='3d62362a78c9412766471b05253507a4cfc212daea5cdf122860173ce902400e'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p /opt/java/openjdk; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory /opt/java/openjdk \
--strip-components 1 \
--no-same-owner \
; \
rm -rf /tmp/openjdk.tar.gz;

ENV JAVA_HOME=/opt/java/openjdk \
PATH="/opt/java/openjdk/bin:$PATH" ENV=${USER_HOME}"/.ashrc"

# set Docker image build arguments
# build arguments for user/group configurations
Expand All @@ -31,6 +79,7 @@ ARG USER_HOME=/home/${USER}
# build arguments for WSO2 product installation
ARG WSO2_SERVER_NAME=wso2is
ARG WSO2_SERVER_VERSION=5.9.0
ARG WSO2_SERVER_REPOSITORY=product-is
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
ARG WSO2_SERVER_DIST_URL=https://bintray.com/wso2/binaryGA/download_file?file_path=${WSO2_SERVER}.zip
Expand Down Expand Up @@ -63,14 +112,21 @@ RUN \

# copy init script to user home
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/

# install required packages
RUN apk add --no-cache netcat-openbsd
RUN \
apk update \
&& apk add --no-cache netcat-openbsd \
&& apk add unzip \
&& apk add wget

# add the WSO2 product distribution to user's home directory
RUN \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
&& rm -f ${WSO2_SERVER}.zip

# add libraries for Kubernetes membership scheme based clustering
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/dnsjava/dnsjava/${DNS_JAVA_VERSION}/dnsjava-${DNS_JAVA_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/lib/
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/org/wso2/carbon/kubernetes/artifacts/kubernetes-membership-scheme/${K8S_MEMBERSHIP_SCHEME_VERSION}/kubernetes-membership-scheme-${K8S_MEMBERSHIP_SCHEME_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
Expand Down
61 changes: 45 additions & 16 deletions dockerfiles/centos/is/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,40 @@
#
# ------------------------------------------------------------------------

# set base Docker image to latest CentOS Docker image
# Set base Docker image to CentOS Docker image.
FROM centos:7
LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.5"
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# Install JDK Dependencies.
RUN yum install -y tzdata openssl curl ca-certificates fontconfig gzip tar \
&& yum clean all

ENV JAVA_VERSION jdk8u322-b06

# Install JDK8.
RUN set -eux; \
ARCH="$(objdump="$(command -v objdump)" && objdump --file-headers "$objdump" | awk -F '[:,]+[[:space:]]+' '$1 == "architecture" { print $2 }')"; \
case "${ARCH}" in \
amd64|i386:x86-64) \
ESUM='3d62362a78c9412766471b05253507a4cfc212daea5cdf122860173ce902400e'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
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"

# set Docker image build arguments
# build arguments for user/group configurations
Expand All @@ -28,11 +58,10 @@ ARG USER_ID=802
ARG USER_GROUP=wso2
ARG USER_GROUP_ID=802
ARG USER_HOME=/home/${USER}
# set JDK configurations
ARG JAVA_HOME=${USER_HOME}/java
# build arguments for WSO2 product installation
ARG WSO2_SERVER_NAME=wso2is
ARG WSO2_SERVER_VERSION=5.9.0
ARG WSO2_SERVER_REPOSITORY=product-is
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
ARG WSO2_SERVER_DIST_URL=https://bintray.com/wso2/binaryGA/download_file?file_path=${WSO2_SERVER}.zip
Expand All @@ -46,16 +75,24 @@ Welcome to WSO2 Docker resources.\n\
------------------------------------ \n\
This Docker container comprises of a WSO2 product, running with its latest GA release \n\
which is under the Apache License, Version 2.0. \n\
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n\n"'
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n"'

# create the non-root user and group and set MOTD login message
RUN \
groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} \
&& useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP_ID} -u ${USER_ID} ${USER} \
&& echo ${MOTD} > /etc/profile.d/motd.sh
# create Java prefs dir
# this is to avoid warning logs printed by FileSystemPreferences class
RUN \
mkdir -p ${USER_HOME}/.java/.systemPrefs \
&& mkdir -p ${USER_HOME}/.java/.userPrefs \
&& chmod -R 755 ${USER_HOME}/.java \
&& chown -R ${USER}:${USER_GROUP} ${USER_HOME}/.java

# copy init script to user home
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/

# install required packages
RUN \
yum -y update \
Expand All @@ -64,20 +101,14 @@ RUN \
unzip \
wget \
&& rm -rf /var/cache/yum/*
# install AdoptOpenJDK HotSpot
RUN \
mkdir -p ${JAVA_HOME} \
&& wget -O OpenJDK8U-jdk_x64_linux_hotspot.tar.gz https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u222b10.tar.gz \
&& echo "37356281345b93feb4212e6267109b4409b55b06f107619dde4960e402bafa77 OpenJDK8U-jdk_x64_linux_hotspot.tar.gz" | sha256sum -c - \
&& tar -xf OpenJDK8U-jdk_x64_linux_hotspot.tar.gz -C ${JAVA_HOME} --strip-components=1 \
&& chown wso2carbon:wso2 -R ${JAVA_HOME} \
&& rm -f OpenJDK8U-jdk_x64_linux_hotspot.tar.gz

# add the WSO2 product distribution to user's home directory
RUN \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
&& rm -f ${WSO2_SERVER}.zip

# add libraries for Kubernetes membership scheme based clustering
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/dnsjava/dnsjava/${DNS_JAVA_VERSION}/dnsjava-${DNS_JAVA_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/lib/
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/org/wso2/carbon/kubernetes/artifacts/kubernetes-membership-scheme/${K8S_MEMBERSHIP_SCHEME_VERSION}/kubernetes-membership-scheme-${K8S_MEMBERSHIP_SCHEME_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
Expand All @@ -89,9 +120,7 @@ USER ${USER_ID}
WORKDIR ${USER_HOME}

# set environment variables
ENV JAVA_HOME=${JAVA_HOME} \
PATH=${JAVA_HOME}/bin:${PATH} \
WORKING_DIRECTORY=${USER_HOME} \
ENV WORKING_DIRECTORY=${USER_HOME} \
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}

# expose ports
Expand Down
45 changes: 42 additions & 3 deletions dockerfiles/ubuntu/is/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,45 @@
#
# ------------------------------------------------------------------------

# set base Docker image to AdoptOpenJDK Ubuntu Docker image
FROM adoptopenjdk:8u222-b10-jdk-hotspot
# Set base Docker image to Ubuntu 20.04 Docker image.
FROM ubuntu:20.04

LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v5.9.0.5"

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

# Install JDK Dependencies.
RUN 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/*

ENV JAVA_VERSION jdk8u322-b06

# Install JDK8.
RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
case "${ARCH}" in \
amd64|x86_64) \
ESUM='3d62362a78c9412766471b05253507a4cfc212daea5cdf122860173ce902400e'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
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"

# set Docker image build arguments
# build arguments for user/group configurations
Expand All @@ -31,6 +66,7 @@ ARG USER_HOME=/home/${USER}
# build arguments for WSO2 product installation
ARG WSO2_SERVER_NAME=wso2is
ARG WSO2_SERVER_VERSION=5.9.0
ARG WSO2_SERVER_REPOSITORY=product-is
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
ARG WSO2_SERVER_DIST_URL=https://bintray.com/wso2/binaryGA/download_file?file_path=${WSO2_SERVER}.zip
Expand Down Expand Up @@ -62,6 +98,7 @@ RUN \

# copy init script to user home
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/

# install required packages
RUN \
apt-get update \
Expand All @@ -70,12 +107,14 @@ RUN \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*

# add the WSO2 product distribution to user's home directory
RUN \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
&& rm -f ${WSO2_SERVER}.zip

# add libraries for Kubernetes membership scheme based clustering
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/dnsjava/dnsjava/${DNS_JAVA_VERSION}/dnsjava-${DNS_JAVA_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/lib/
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/org/wso2/carbon/kubernetes/artifacts/kubernetes-membership-scheme/${K8S_MEMBERSHIP_SCHEME_VERSION}/kubernetes-membership-scheme-${K8S_MEMBERSHIP_SCHEME_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
Expand Down

0 comments on commit 0d15212

Please sign in to comment.