Skip to content

Commit 2a33f37

Browse files
authored
Merge pull request #394 from ThaminduR/6.1.0-jdk17
Add JDK 17 6.1.0 dockerfiles
2 parents 6995abf + 20b156d commit 2a33f37

File tree

10 files changed

+759
-0
lines changed

10 files changed

+759
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ in each resource release, will be documented in this file.
55

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

8+
## v6.1.0.5 - 2024-02-28
9+
10+
### Changed
11+
- JDK17 support.
12+
813
## v6.1.0.4 - 2024-02-12
914

1015
### Changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# ------------------------------------------------------------------------
2+
#
3+
# Copyright 2024 WSO2, LLC. (http://wso2.com)
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License
16+
#
17+
# ------------------------------------------------------------------------
18+
19+
# set base Docker image to Alpine Docker image
20+
FROM alpine:3.16
21+
LABEL maintainer="WSO2 Docker Maintainers <[email protected]>" \
22+
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v6.1.0.5"
23+
24+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
25+
26+
# Install JDK Dependencies
27+
RUN apk add --no-cache tzdata musl-locales musl-locales-lang \
28+
&& rm -rf /var/cache/apk/*
29+
30+
ENV JAVA_VERSION jdk-17.0.9+9.1
31+
32+
# Install JDK17
33+
RUN set -eux; \
34+
apk add --no-cache --virtual .fetch-deps curl; \
35+
ARCH="$(apk --print-arch)"; \
36+
case "${ARCH}" in \
37+
amd64|x86_64) \
38+
ESUM='c2a571a56e5bd3f30956b17b048880078c7801ed9e8754af6d1e38b9176059a9'; \
39+
BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_alpine-linux_hotspot_17.0.9_9.tar.gz'; \
40+
;; \
41+
*) \
42+
echo "Unsupported arch: ${ARCH}"; \
43+
exit 1; \
44+
;; \
45+
esac; \
46+
wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
47+
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
48+
mkdir -p /opt/java/openjdk; \
49+
tar --extract \
50+
--file /tmp/openjdk.tar.gz \
51+
--directory /opt/java/openjdk \
52+
--strip-components 1 \
53+
--no-same-owner \
54+
; \
55+
rm -rf /tmp/openjdk.tar.gz;
56+
57+
ENV JAVA_HOME=/opt/java/openjdk \
58+
PATH="/opt/java/openjdk/bin:$PATH" ENV=${USER_HOME}"/.ashrc"
59+
60+
# set Docker image build arguments
61+
# build arguments for user/group configurations
62+
ARG USER=wso2carbon
63+
ARG USER_ID=802
64+
ARG USER_GROUP=wso2
65+
ARG USER_GROUP_ID=802
66+
ARG USER_HOME=/home/${USER}
67+
# build arguments for WSO2 product installation
68+
ARG WSO2_SERVER_NAME=wso2is
69+
ARG WSO2_SERVER_VERSION=6.1.0
70+
ARG WSO2_SERVER_REPOSITORY=product-is
71+
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
72+
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
73+
# Hosted wso2is-6.1.0 distribution URL.
74+
ARG WSO2_SERVER_DIST_URL=""
75+
# build arguments for external artifacts
76+
ARG DNS_JAVA_VERSION=2.1.8
77+
ARG K8S_MEMBERSHIP_SCHEME_VERSION=1.0.10
78+
ARG MYSQL_CONNECTOR_VERSION=8.0.29
79+
# build argument for MOTD
80+
ARG MOTD='printf "\n\
81+
Welcome to WSO2 Docker Resources \n\
82+
--------------------------------- \n\
83+
This Docker container comprises of a WSO2 product, running with its latest GA release \n\
84+
which is under the Apache License, Version 2.0. \n\
85+
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n"'
86+
87+
# create the non-root user and group and set MOTD login message
88+
RUN \
89+
addgroup -S -g ${USER_GROUP_ID} ${USER_GROUP} \
90+
&& adduser -S -u ${USER_ID} -h ${USER_HOME} -G ${USER_GROUP} ${USER} \
91+
&& echo ${MOTD} > "${ENV}"
92+
93+
# create Java prefs dir
94+
# this is to avoid warning logs printed by FileSystemPreferences class
95+
RUN \
96+
mkdir -p ${USER_HOME}/.java/.systemPrefs \
97+
&& mkdir -p ${USER_HOME}/.java/.userPrefs \
98+
&& chmod -R 755 ${USER_HOME}/.java \
99+
&& chown -R ${USER}:${USER_GROUP} ${USER_HOME}/.java
100+
101+
# copy init script to user home
102+
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/
103+
104+
# install required packages
105+
RUN \
106+
apk update \
107+
&& apk add --no-cache netcat-openbsd \
108+
&& apk add unzip \
109+
&& apk add wget
110+
111+
RUN \
112+
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
113+
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
114+
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
115+
&& rm -f ${WSO2_SERVER}.zip
116+
117+
# add libraries for Kubernetes membership scheme based clustering
118+
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
119+
ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/releases/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
120+
# add MySQL JDBC connector to server home as a third party library
121+
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_CONNECTOR_VERSION}/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
122+
123+
# Set the user and work directory.
124+
USER ${USER_ID}
125+
WORKDIR ${USER_HOME}
126+
127+
# set environment variables
128+
ENV WORKING_DIRECTORY=${USER_HOME} \
129+
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}
130+
131+
# expose ports
132+
EXPOSE 4000 9763 9443
133+
134+
# initiate container and start WSO2 Carbon server
135+
ENTRYPOINT ["/home/wso2carbon/docker-entrypoint.sh"]
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Dockerfile for WSO2 Identity Server #
2+
3+
This section defines the step-by-step instructions to build an [Alpine](https://hub.docker.com/_/alpine/) Linux based Docker image for WSO2 Identity Server `6.1.0`.
4+
5+
## Prerequisites
6+
7+
* [Docker](https://www.docker.com/get-docker) `v17.09.0` or above
8+
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) client
9+
10+
## How to build an image and run
11+
12+
##### 1. Checkout this repository into your local machine using the following Git client command.
13+
14+
```
15+
git clone https://github.com/wso2/docker-is.git
16+
```
17+
18+
>The local copy of the `dockerfiles/alpine/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards.
19+
20+
##### 2. Build the Docker image.
21+
- Navigate to `<IS_DOCKERFILE_HOME>` directory. <br>
22+
Execute `docker build` command as shown below.
23+
+ `docker build -t wso2is:6.1.0-alpine .`
24+
25+
> Configure the URL of hosted wso2is-6.1.0 distribution as WSO2_SERVER_DIST_URL.
26+
27+
> Tip - If you require the container to run with a different UID and GID, pass the preferred values of the UID and GID
28+
> as values for build arguments `USER_ID` and `USER_GROUP_ID` when building the image, as shown below. Note
29+
> that setting lower values for the UID and GID is not recommended.
30+
+ `docker build -t wso2is:6.1.0-alpine --build-arg USER_ID=<UID> --build-arg USER_GROUP_ID=<GID> .`
31+
32+
##### 3. Running the Docker image.
33+
34+
- `docker run -it -p 9443:9443 wso2is:6.1.0-alpine`
35+
36+
>Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port.
37+
You may map other container service ports, which have been exposed to Docker host ports, as desired.
38+
39+
##### 4. Accessing management consoles.
40+
41+
- To access the user interfaces, use the docker host IP and port 9443.
42+
+ Management Console: `https://<DOCKER_HOST>:9443/console`
43+
+ User Portal: `https://<DOCKER_HOST>:9443/myaccount`
44+
45+
>In here, <DOCKER_HOST> refers to hostname or IP of the host machine on top of which containers are spawned.
46+
47+
## How to update configurations
48+
49+
Configurations would lie on the Docker host machine and they can be volume mounted to the container. <br>
50+
As an example, steps required to change the port offset using `deployment.toml` is as follows:
51+
52+
##### 1. Stop the Identity Server container if it's already running.
53+
54+
In WSO2 Identity Server version `6.1.0` product distribution, `deployment.toml` configuration file <br>
55+
can be found at `<DISTRIBUTION_HOME>/repository/conf`. Copy the file to some suitable location of the host machine, <br>
56+
referred to as `<SOURCE_CONFIGS>/deployment.toml` and change the `[server] -> offset` value to 1.
57+
58+
##### 2. Grant read permission to `other` users for `<SOURCE_CONFIGS>/deployment.toml`.
59+
60+
```
61+
chmod o+r <SOURCE_CONFIGS>/deployment.toml
62+
```
63+
64+
##### 3. Run the image by mounting the file to container as follows:
65+
66+
```
67+
docker run \
68+
-p 9444:9444 \
69+
--volume <SOURCE_CONFIGS>/deployment.toml:<TARGET_CONFIGS>/deployment.toml \
70+
wso2is:6.1.0-alpine
71+
```
72+
73+
>In here, <TARGET_CONFIGS> refers to /home/wso2carbon/wso2is-6.1.0/repository/conf folder of the container.
74+
75+
## Docker command usage references
76+
77+
* [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/)
78+
* [Docker run command reference](https://docs.docker.com/engine/reference/run/)
79+
* [Dockerfile reference](https://docs.docker.com/engine/reference/builder/)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
# ------------------------------------------------------------------------
3+
# Copyright 2024 WSO2, LLC. (http://wso2.com)
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License
16+
# ------------------------------------------------------------------------
17+
18+
set -e
19+
20+
# volume mounts
21+
config_volume=${WORKING_DIRECTORY}/wso2-config-volume
22+
artifact_volume=${WORKING_DIRECTORY}/wso2-artifact-volume
23+
24+
# check if the WSO2 non-root user home exists
25+
test ! -d ${WORKING_DIRECTORY} && echo "WSO2 Docker non-root user home does not exist" && exit 1
26+
27+
# check if the WSO2 product home exists
28+
test ! -d ${WSO2_SERVER_HOME} && echo "WSO2 Docker product home does not exist" && exit 1
29+
30+
# copy any configuration changes mounted to config_volume
31+
test -d ${config_volume} && [ "$(ls -A ${config_volume})" ] && cp -RL ${config_volume}/* ${WSO2_SERVER_HOME}/
32+
# copy any artifact changes mounted to artifact_volume
33+
test -d ${artifact_volume} && [ "$(ls -A ${artifact_volume})" ] && cp -RL ${artifact_volume}/* ${WSO2_SERVER_HOME}/
34+
35+
# start WSO2 Carbon server
36+
sh ${WSO2_SERVER_HOME}/bin/wso2server.sh "$@"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# ------------------------------------------------------------------------
2+
#
3+
# Copyright 2024 WSO2, LLC. (http://wso2.com)
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License
16+
#
17+
# ------------------------------------------------------------------------
18+
19+
# set base Docker image to CentOS Docker image
20+
FROM centos:7
21+
LABEL maintainer="WSO2 Docker Maintainers <[email protected]>" \
22+
com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v6.1.0.5"
23+
24+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
25+
26+
# Install JDK Dependencies
27+
RUN yum install -y tzdata openssl curl ca-certificates fontconfig gzip tar \
28+
&& yum clean all
29+
30+
ENV JAVA_VERSION jdk-17.0.9+9
31+
32+
# Install JDK11
33+
RUN set -eux; \
34+
ARCH="$(objdump="$(command -v objdump)" && objdump --file-headers "$objdump" | awk -F '[:,]+[[:space:]]+' '$1 == "architecture" { print $2 }')"; \
35+
case "${ARCH}" in \
36+
amd64|i386:x86-64) \
37+
ESUM='7b175dbe0d6e3c9c23b6ed96449b018308d8fc94a5ecd9c0df8b8bc376c3c18a'; \
38+
BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz'; \
39+
;; \
40+
*) \
41+
echo "Unsupported arch: ${ARCH}"; \
42+
exit 1; \
43+
;; \
44+
esac; \
45+
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
46+
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
47+
mkdir -p /opt/java/openjdk; \
48+
cd /opt/java/openjdk; \
49+
tar -xf /tmp/openjdk.tar.gz --strip-components=1; \
50+
rm -rf /tmp/openjdk.tar.gz;
51+
52+
ENV JAVA_HOME=/opt/java/openjdk \
53+
PATH="/opt/java/openjdk/bin:$PATH"
54+
55+
# set Docker image build arguments
56+
# build arguments for user/group configurations
57+
ARG USER=wso2carbon
58+
ARG USER_ID=802
59+
ARG USER_GROUP=wso2
60+
ARG USER_GROUP_ID=802
61+
ARG USER_HOME=/home/${USER}
62+
# build arguments for WSO2 product installation
63+
ARG WSO2_SERVER_NAME=wso2is
64+
ARG WSO2_SERVER_VERSION=6.1.0
65+
ARG WSO2_SERVER_REPOSITORY=product-is
66+
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
67+
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
68+
# Hosted wso2is-6.1.0 distribution URL.
69+
ARG WSO2_SERVER_DIST_URL=""
70+
# build arguments for external artifacts
71+
ARG DNS_JAVA_VERSION=2.1.8
72+
ARG K8S_MEMBERSHIP_SCHEME_VERSION=1.0.10
73+
ARG MYSQL_CONNECTOR_VERSION=8.0.29
74+
# build argument for MOTD
75+
ARG MOTD='printf "\n\
76+
Welcome to WSO2 Docker resources.\n\
77+
------------------------------------ \n\
78+
This Docker container comprises of a WSO2 product, running with its latest GA release \n\
79+
which is under the Apache License, Version 2.0. \n\
80+
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n"'
81+
82+
# create the non-root user and group and set MOTD login message
83+
RUN \
84+
groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} \
85+
&& useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP_ID} -u ${USER_ID} ${USER} \
86+
&& echo ${MOTD} > /etc/profile.d/motd.sh
87+
# create Java prefs dir
88+
# this is to avoid warning logs printed by FileSystemPreferences class
89+
RUN \
90+
mkdir -p ${USER_HOME}/.java/.systemPrefs \
91+
&& mkdir -p ${USER_HOME}/.java/.userPrefs \
92+
&& chmod -R 755 ${USER_HOME}/.java \
93+
&& chown -R ${USER}:${USER_GROUP} ${USER_HOME}/.java
94+
95+
# copy init script to user home
96+
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/
97+
98+
# install required packages
99+
RUN \
100+
yum -y update \
101+
&& yum install -y \
102+
nc \
103+
unzip \
104+
wget \
105+
&& rm -rf /var/cache/yum/*
106+
107+
RUN \
108+
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
109+
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
110+
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
111+
&& rm -f ${WSO2_SERVER}.zip
112+
113+
# add libraries for Kubernetes membership scheme based clustering
114+
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
115+
ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/releases/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
116+
# add MySQL JDBC connector to server home as a third party library
117+
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_CONNECTOR_VERSION}/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
118+
119+
# Set the user and work directory.
120+
USER ${USER_ID}
121+
WORKDIR ${USER_HOME}
122+
123+
# set environment variables
124+
ENV WORKING_DIRECTORY=${USER_HOME} \
125+
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}
126+
127+
# expose ports
128+
EXPOSE 4000 9763 9443
129+
130+
# initiate container and start WSO2 Carbon server
131+
ENTRYPOINT ["/home/wso2carbon/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)