Skip to content

Commit

Permalink
Merge pull request #436 from PasanT9/3.0.x-apim-analytics
Browse files Browse the repository at this point in the history
[APIM Analytics] [3.0.x] Modify Docker images to use base OS image and build Temurin OpenJDK
  • Loading branch information
tgtshanika authored Mar 3, 2022
2 parents 09a5b31 + 3602ace commit 1b9f4db
Show file tree
Hide file tree
Showing 6 changed files with 348 additions and 42 deletions.
76 changes: 73 additions & 3 deletions dockerfiles/alpine/apim-analytics/dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,80 @@
#
# ------------------------------------------------------------------------

# 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

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 --virtual .build-deps curl binutils zstd \
&& GLIBC_VER="2.33-r0" \
&& ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
&& GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
&& GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
&& ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
&& ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
&& curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
&& SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
&& echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
&& curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
&& curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
&& curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
&& /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
&& echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
&& curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
&& echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
&& mkdir /tmp/gcc \
&& zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
&& tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
&& mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
&& strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
&& curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
&& echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
&& mkdir /tmp/libz \
&& tar -xf /tmp/libz.tar.xz -C /tmp/libz \
&& mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
&& apk del --purge .build-deps glibc-i18n \
&& rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*

ENV JAVA_VERSION=jdk8u322-b06

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; \
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; \
apk del --purge .fetch-deps; \
rm -rf /var/cache/apk/*; \
rm -rf /tmp/openjdk.tar.gz;

ENV JAVA_HOME=/opt/java/openjdk \
PATH="/opt/java/openjdk/bin:$PATH"

# Verify Java installation
RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version \
&& echo Complete.

LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.5"

# set Docker image build arguments
# build arguments for user/group configurations
Expand Down
76 changes: 73 additions & 3 deletions dockerfiles/alpine/apim-analytics/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,80 @@
#
# ------------------------------------------------------------------------

# 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

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 --virtual .build-deps curl binutils zstd \
&& GLIBC_VER="2.33-r0" \
&& ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" \
&& GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-10.1.0-2-x86_64.pkg.tar.zst" \
&& GCC_LIBS_SHA256="f80320a03ff73e82271064e4f684cd58d7dbdb07aa06a2c4eea8e0f3c507c45c" \
&& ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" \
&& ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 \
&& curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
&& SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" \
&& echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - \
&& curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-${GLIBC_VER}.apk \
&& curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk \
&& curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk \
&& apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk \
&& /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true \
&& echo "export LANG=$LANG" > /etc/profile.d/locale.sh \
&& curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.zst \
&& echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.zst" | sha256sum -c - \
&& mkdir /tmp/gcc \
&& zstd -d /tmp/gcc-libs.tar.zst --output-dir-flat /tmp \
&& tar -xf /tmp/gcc-libs.tar -C /tmp/gcc \
&& mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib \
&& strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* \
&& curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz \
&& echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - \
&& mkdir /tmp/libz \
&& tar -xf /tmp/libz.tar.xz -C /tmp/libz \
&& mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib \
&& apk del --purge .build-deps glibc-i18n \
&& rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar* /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*

ENV JAVA_VERSION=jdk8u322-b06

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; \
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; \
apk del --purge .fetch-deps; \
rm -rf /var/cache/apk/*; \
rm -rf /tmp/openjdk.tar.gz;

ENV JAVA_HOME=/opt/java/openjdk \
PATH="/opt/java/openjdk/bin:$PATH"

# Verify Java installation
RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version \
&& echo Complete.

LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.5"

# set Docker image build arguments
# build arguments for user/group configurations
Expand Down
65 changes: 50 additions & 15 deletions dockerfiles/centos/apim-analytics/dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# set base Docker image to latest CentOS Docker image
FROM centos:7
LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.5"

# set Docker image build arguments
# build arguments for user/group configurations
Expand All @@ -28,8 +28,6 @@ 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=wso2am-analytics
ARG WSO2_SERVER_VERSION=3.0.0
Expand All @@ -46,6 +44,9 @@ This Docker container comprises of a WSO2 product, running with its latest GA re
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"'

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

# create the non-root user and group and set MOTD login message
RUN \
groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} \
Expand All @@ -54,22 +55,58 @@ RUN \

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

# install required packages
RUN \
yum -y update \
&& yum install -y \
tzdata openssl curl ca-certificates fontconfig gzip tar \
nc \
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
zip \
&& yum clean all \
&& rm -rf /var/cache/yum/*

# install OpenJDK
RUN set -eux; \
ARCH="$(objdump="$(command -v objdump)" && objdump --file-headers "$objdump" | awk -F '[:,]+[[:space:]]+' '$1 == "architecture" { print $2 }')"; \
case "${ARCH}" in \
aarch64|arm64) \
ESUM='42ed3ff5a859f9015a1362fb7e650026b913d688eab471714f795651120be173'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_aarch64_linux_hotspot_8u322b06.tar.gz'; \
;; \
ppc64el|powerpc:common64) \
ESUM='c7cc9c5b237e9e1f1e3296593aba427375823592e4604fadf89a8c234c2574e1'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_ppc64le_linux_hotspot_8u322b06.tar.gz'; \
;; \
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"

RUN chown wso2carbon:wso2 -R ${JAVA_HOME}

# Verify Java installation
RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version \
&& echo Complete.

# add the WSO2 product distribution to user's home directory
RUN \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
Expand All @@ -84,9 +121,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
65 changes: 50 additions & 15 deletions dockerfiles/centos/apim-analytics/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# set base Docker image to latest CentOS Docker image
FROM centos:7
LABEL maintainer="WSO2 Docker Maintainers <dev@wso2.org>" \
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.4"
com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v3.0.0.5"

# set Docker image build arguments
# build arguments for user/group configurations
Expand All @@ -28,8 +28,6 @@ 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=wso2am-analytics
ARG WSO2_SERVER_VERSION=3.0.0
Expand All @@ -46,6 +44,9 @@ This Docker container comprises of a WSO2 product, running with its latest GA re
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"'

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

# create the non-root user and group and set MOTD login message
RUN \
groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} \
Expand All @@ -54,22 +55,58 @@ RUN \

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

# install required packages
RUN \
yum -y update \
&& yum install -y \
tzdata openssl curl ca-certificates fontconfig gzip tar \
nc \
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
zip \
&& yum clean all \
&& rm -rf /var/cache/yum/*

# install OpenJDK
RUN set -eux; \
ARCH="$(objdump="$(command -v objdump)" && objdump --file-headers "$objdump" | awk -F '[:,]+[[:space:]]+' '$1 == "architecture" { print $2 }')"; \
case "${ARCH}" in \
aarch64|arm64) \
ESUM='42ed3ff5a859f9015a1362fb7e650026b913d688eab471714f795651120be173'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_aarch64_linux_hotspot_8u322b06.tar.gz'; \
;; \
ppc64el|powerpc:common64) \
ESUM='c7cc9c5b237e9e1f1e3296593aba427375823592e4604fadf89a8c234c2574e1'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_ppc64le_linux_hotspot_8u322b06.tar.gz'; \
;; \
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"

RUN chown wso2carbon:wso2 -R ${JAVA_HOME}

# Verify Java installation
RUN echo Verifying install ... \
&& echo javac -version && javac -version \
&& echo java -version && java -version \
&& echo Complete.

# add the WSO2 product distribution to user's home directory
RUN \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
Expand All @@ -84,9 +121,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
Loading

0 comments on commit 1b9f4db

Please sign in to comment.