Skip to content

March update #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions Dockerfile-adoptium-temurin-jdk8
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# docker build -t sathya1104/openjdk:8-alpine-temurin . -f Dockerfile-adoptium-temurin-jdk8 --no-cache

FROM alpine:latest

# Download jdk binary from temurin github (in future add sha checksum verification)
# Use jlink and we can use it remove more default modules and reduce image size

# see https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/KEYS
# see also "update.sh" (https://github.com/docker-library/tomcat/blob/master/update.sh)


ENV JDK_MAJOR 8
ENV JDK_VERSION 8u362b09
ENV JDK_PATCH_VERSION jdk8u362
ENV JDK_BUILD_VERSION b09

ENV JDK_DOWNLOAD_URL https://github.com/adoptium/temurin8-binaries/releases/download/${JDK_PATCH_VERSION}-${JDK_BUILD_VERSION}/OpenJDK8U-jdk_x64_alpine-linux_hotspot_${JDK_VERSION}.tar.gz

WORKDIR /root

# Download JDK
RUN set -eux;\
mkdir -p /usr/lib/jvm/default-jvm/ \
&& wget "$JDK_DOWNLOAD_URL" -qO /usr/lib/jvm/default-jvm/OpenJDK8-jdk_x64_alpine-linux_hotspot_${JDK_VERSION}.tar.gz\
&& tar -xf /usr/lib/jvm/default-jvm/OpenJDK8-jdk_x64_alpine-linux_hotspot_${JDK_VERSION}.tar.gz -C /usr/lib/jvm/default-jvm/ --strip-components=1\
&& rm -rf /usr/lib/jvm/default-jvm/OpenJDK8-jdk_x64_alpine-linux_hotspot_${JDK_VERSION}.tar.gz


ENV OS_RELEASE="Alpine Linux v3.17"

# Installed main dependencies:
# ca-certificates-bundle-20220614-r4 x86_64: for certificate management to support SSL
# openjdk8-jre: OpenJDK built by Timo Teräs <[email protected]> from https://icedtea.classpath.org/
# https://git.alpinelinux.org/aports/commit/?id=f10a27abc4a038853c5b0f74655a1ca75356c93a
# fontconfig-2.14.1-r0 x86_64 : For supporting UI/ Fonts for reporting purposes
# freetype-2.12.1-r0 x86_64: To support freetype fonts
# openjre: Java Runtime Container

# https://adoptopenjdk.net/installation.html#x64_linux-jre
# Set JRE_HOME not JAVA_HOME as we don't intend to run tomcat in debug mode
ENV JRE_HOME=/usr/lib/jvm/default-jvm/jre
COPY Dockerfile-tomcat-jre-adoptium-temurin-jdk8 /tmp
ENV PATH=${JRE_HOME}/bin:$PATH
ENV JAVA_VERSION=1.8.0_362

RUN set -eux;\

# CIS-4.7 Ensure update instructions are not use alone in the Dockerfile
# apk update \
# && apk upgrade \
# && apk add --no-cache ca-certificates\

# Now Add Support for cacerts
# https://hackernoon.com/alpine-docker-image-with-secured-communication-ssl-tls-go-restful-api-128eb6b54f1f
apk add --no-cache ca-certificates\

# Now Add Support for UI/Font configurations
# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
\fontconfig freetype\

&& rm -rf /var/cache/apk/*

RUN apk add --update curl && \
apk add --update iputils && \
apk add --update netcat-openbsd && \
apk add --update tzdata && \
apk add --update openssl && \
apk add --update lcms2 && \
rm -rf /var/cache/apk/* && \
curl --version && \
ping -c4 localhost && \
nc -h

# COPY ./org-cacert-bundle.crt /usr/local/share/ca-certificates/mycert.crt
# COPY --from stage-0 /usr/local/share/ca-certificates /usr/local/share/ca-certificates
RUN set -eux;\
chmod 755 /usr/local/share/ca-certificates\
&& update-ca-certificates\
# Load Organisational fonts
&& mkdir -p /usr/share/fonts/default/TrueType
# COPY --from stage-0 /tmp/custom-fonts/ /usr/share/fonts/default/TrueType

# User Management
# Add custom group openjre with 1001 as a groupid to avoid conflicts with any existing groups
RUN addgroup -g 1001 openjre

# Add custom user openjre with same uid 1001 as gid to avoid conflict with exist user
# User with no home directory, no password, group as openjre and username as openjre
RUN adduser -H -D -G openjre -u 1001 openjre

# We put the openjre user as the owner of the folder of openjre to limit access to openjre process on container resources
RUN set -eux;\
mkdir -p /usr/local/opt\
&& mkdir -p /usr/local/log\
&& chown -R openjre:openjre /usr/local/opt\
# Users cannot modify configuration of openjre
&& chmod -R g+w /usr/local/log\
# Activate the sticky-bit for new files keep permissions defined:
&& chmod -R g+s /usr/local/opt\
&& chmod -R g+s /usr/local/log


# Set user as tocmat by uid to be compatible with kubernetes psp
USER 1001

EXPOSE 8080

CMD ["jshell"]
47 changes: 47 additions & 0 deletions Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#Once after building this image, run a container with sh with below
# i) cat /etc/os-release --> Look for version of Alpine Linux to substitute in Dockerfile-tomcat-jre/jre8
# ii) from apk updated components -> Look for version of fontconfig, freetype, ca-certificates to substitute in Dockerfile-tomcat-jre/jre8
# iii) java -version --> Look for version of open jdk to substitute in Dockerfile-tomcat-jre/jre8

FROM alpine:latest
MAINTAINER "Sathya KUMARASWAMY <[email protected]>"
#ENV OS_RELEASE="Alpine Linux v3.12"

# Installed main dependencies:
# ca-certificates-bundle-20191127-r5 x86_64: for certificate management to support SSL
# openjdk8-jre: OpenJDK built by Timo Teräs <[email protected]> from https://icedtea.classpath.org/
# https://git.alpinelinux.org/aports/commit/?id=f10a27abc4a038853c5b0f74655a1ca75356c93a
# fontconfig-2.13.1-r3 x86_64 : For supporting UI/ Fonts for reporting purposes
# freetype-2.10.4-r1 x86_64: To support freetype fonts
# Tomcat: Java Runtime Container

# https://adoptopenjdk.net/installation.html#x64_linux-jre
# Set JRE_HOME not JAVA_HOME as we don't intend to run tomcat in debug mode
ENV JRE_HOME=/usr/lib/jvm/default-jvm/jre
RUN apk --no-cache --virtual add openjdk8-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
ENV PATH=${JRE_HOME}/bin:$PATH
#ENV JAVA_VERSION=1.8.0_282-b08

RUN set -eux;\
apk update \
&& apk upgrade \
# Now Add Support for cacerts
# https://hackernoon.com/alpine-docker-image-with-secured-communication-ssl-tls-go-restful-api-128eb6b54f1f
&& apk add --no-cache ca-certificates\

# Now Add Support for UI/Font configurations
# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
\fontconfig freetype\

&& rm -rf /var/cache/apk/*

# COPY ./org-cacert-bundle.crt /usr/local/share/ca-certificates/mycert.crt
# COPY --from stage-0 /usr/local/share/ca-certificates /usr/local/share/ca-certificates
RUN set -eux;\
chmod 755 /usr/local/share/ca-certificates\
&& update-ca-certificates\
# Load Organisational fonts
&& mkdir -p /usr/share/fonts/default/TrueType
# COPY --from stage-0 /tmp/custom-fonts/ /usr/share/fonts/default/TrueType
52 changes: 52 additions & 0 deletions Dockerfile-alpine-jre11
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# docker build -t alpine-jre11 . -f Dockerfile-alpine-jre11 --no-cache
FROM alpine:latest AS stage-0
# Prefer openjdk11 over openjdk11-jre for jlink and we can use it remove more default modules and reduce image size
RUN set -eux;\
apk --no-cache --virtual add openjdk11 \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
WORKDIR /usr/lib/jvm/default-jvm/jre/bin/
RUN set -eux;\
./jlink --output jre --compress=2 --no-header-files --no-man-pages --module-path ../jmods --add-modules jdk.aot,jdk.xml.dom,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto

FROM alpine:latest
MAINTAINER "Sathya KUMARASWAMY <[email protected]>"
ENV OS_RELEASE="Alpine Linux v3.14"

# Installed main dependencies:
# ca-certificates-bundle-20191127-r5 x86_64: for certificate management to support SSL
# openjdk11: OpenJDK built by Simon Frankenberger <[email protected]> from https://hg.openjdk.java.net/jdk-updates/jdk11u
# https://git.alpinelinux.org/aports/commit/?id=b85efc501595136485aea134946fa459bff115b0
# fontconfig-2.13.1-r4 x86_64 : For supporting UI/ Fonts for reporting purposes
# freetype-2.10.4-r1 x86_64: To support freetype fonts
# Tomcat: Java Runtime Container

# https://adoptopenjdk.net/installation.html#x64_linux-jre
# Set JRE_HOME not JAVA_HOME as we don't intend to run tomcat in debug mode
ENV JRE_HOME=/usr/lib/jvm/default-jvm/jre
COPY --from=stage-0 /usr/lib/jvm/default-jvm/jre/bin/jre ${JRE_HOME}
ENV PATH=${JRE_HOME}/bin:$PATH
ENV JAVA_VERSION=11.0.12+7-alpine-r0

RUN set -eux;\
apk update \
&& apk upgrade \
# Now Add Support for cacerts
# https://hackernoon.com/alpine-docker-image-with-secured-communication-ssl-tls-go-restful-api-128eb6b54f1f
&& apk add --no-cache ca-certificates\

# Now Add Support for UI/Font configurations
# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
\fontconfig freetype\

&& rm -rf /var/cache/apk/*

# COPY ./org-cacert-bundle.crt /usr/local/share/ca-certificates/mycert.crt
# COPY --from stage-0 /usr/local/share/ca-certificates /usr/local/share/ca-certificates
RUN set -eux;\
chmod 755 /usr/local/share/ca-certificates\
&& update-ca-certificates\
# Load Organisational fonts
&& mkdir -p /usr/share/fonts/default/TrueType
# COPY --from stage-0 /tmp/custom-fonts/ /usr/share/fonts/default/TrueType
52 changes: 52 additions & 0 deletions Dockerfile-alpine-jre17
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# docker build -t alpine-jre17 . -f Dockerfile-alpine-jre17 --no-cache
FROM alpine:latest AS stage-0
# Prefer openjdk11 over openjdk11-jre for jlink and we can use it remove more default modules and reduce image size
RUN set -eux;\
apk --no-cache --virtual add openjdk17 \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
WORKDIR /usr/lib/jvm/default-jvm/jre/bin/
RUN set -eux;\
./jlink --output jre --compress=2 --no-header-files --no-man-pages --module-path ../jmods --add-modules jdk.xml.dom,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto

FROM alpine:latest
MAINTAINER "Sathya KUMARASWAMY <[email protected]>"
ENV OS_RELEASE="Alpine Linux v3.14"

# Installed main dependencies:
# ca-certificates-bundle-20191127-r5 x86_64: for certificate management to support SSL
# openjdk11: OpenJDK built by Simon Frankenberger <[email protected]> from https://hg.openjdk.java.net/jdk-updates/jdk11u
# https://git.alpinelinux.org/aports/commit/?id=b85efc501595136485aea134946fa459bff115b0
# fontconfig-2.13.1-r4 x86_64 : For supporting UI/ Fonts for reporting purposes
# freetype-2.10.4-r1 x86_64: To support freetype fonts
# Tomcat: Java Runtime Container

# https://adoptopenjdk.net/installation.html#x64_linux-jre
# Set JRE_HOME not JAVA_HOME as we don't intend to run tomcat in debug mode
ENV JRE_HOME=/usr/lib/jvm/default-jvm/jre
COPY --from=stage-0 /usr/lib/jvm/default-jvm/jre/bin/jre ${JRE_HOME}
ENV PATH=${JRE_HOME}/bin:$PATH
#ENV JAVA_VERSION=11.0.11+9-alpine-r0

RUN set -eux;\
apk update \
&& apk upgrade \
# Now Add Support for cacerts
# https://hackernoon.com/alpine-docker-image-with-secured-communication-ssl-tls-go-restful-api-128eb6b54f1f
&& apk add --no-cache ca-certificates\

# Now Add Support for UI/Font configurations
# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
\fontconfig freetype\

&& rm -rf /var/cache/apk/*

# COPY ./org-cacert-bundle.crt /usr/local/share/ca-certificates/mycert.crt
# COPY --from stage-0 /usr/local/share/ca-certificates /usr/local/share/ca-certificates
RUN set -eux;\
chmod 755 /usr/local/share/ca-certificates\
&& update-ca-certificates\
# Load Organisational fonts
&& mkdir -p /usr/share/fonts/default/TrueType
# COPY --from stage-0 /tmp/custom-fonts/ /usr/share/fonts/default/TrueType
47 changes: 47 additions & 0 deletions Dockerfile-alpine-jre8
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#Once after building this image, run a container with sh with below
# i) cat /etc/os-release --> Look for version of Alpine Linux to substitute in Dockerfile-tomcat-jre/jre8
# ii) from apk updated components -> Look for version of fontconfig, freetype, ca-certificates to substitute in Dockerfile-tomcat-jre/jre8
# iii) java -version --> Look for version of open jdk to substitute in Dockerfile-tomcat-jre/jre8

FROM alpine:latest
MAINTAINER "Sathya KUMARASWAMY <[email protected]>"
#ENV OS_RELEASE="Alpine Linux v3.12"

# Installed main dependencies:
# ca-certificates-bundle-20191127-r5 x86_64: for certificate management to support SSL
# openjdk8-jre: OpenJDK built by Timo Teräs <[email protected]> from https://icedtea.classpath.org/
# https://git.alpinelinux.org/aports/commit/?id=f10a27abc4a038853c5b0f74655a1ca75356c93a
# fontconfig-2.13.1-r3 x86_64 : For supporting UI/ Fonts for reporting purposes
# freetype-2.10.4-r1 x86_64: To support freetype fonts
# Tomcat: Java Runtime Container

# https://adoptopenjdk.net/installation.html#x64_linux-jre
# Set JRE_HOME not JAVA_HOME as we don't intend to run tomcat in debug mode
ENV JRE_HOME=/usr/lib/jvm/default-jvm/jre
RUN apk --no-cache --virtual add openjdk8-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
ENV PATH=${JRE_HOME}/bin:$PATH
#ENV JAVA_VERSION=1.8.0_282-b08

RUN set -eux;\
apk update \
&& apk upgrade \
# Now Add Support for cacerts
# https://hackernoon.com/alpine-docker-image-with-secured-communication-ssl-tls-go-restful-api-128eb6b54f1f
&& apk add --no-cache ca-certificates\

# Now Add Support for UI/Font configurations
# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-11/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
\fontconfig freetype\

&& rm -rf /var/cache/apk/*

# COPY ./org-cacert-bundle.crt /usr/local/share/ca-certificates/mycert.crt
# COPY --from stage-0 /usr/local/share/ca-certificates /usr/local/share/ca-certificates
RUN set -eux;\
chmod 755 /usr/local/share/ca-certificates\
&& update-ca-certificates\
# Load Organisational fonts
&& mkdir -p /usr/share/fonts/default/TrueType
# COPY --from stage-0 /tmp/custom-fonts/ /usr/share/fonts/default/TrueType
Loading