diff --git a/dockerfiles/jdk17/rocky/is/Dockerfile b/dockerfiles/jdk17/rocky/is/Dockerfile new file mode 100755 index 00000000..d7ce33a7 --- /dev/null +++ b/dockerfiles/jdk17/rocky/is/Dockerfile @@ -0,0 +1,144 @@ +# ------------------------------------------------------------------------ +# +# Copyright 2024 WSO2, LLC. (http://wso2.com) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +# +# ------------------------------------------------------------------------ + +# set base Docker image to Rocky Linux Docker image +FROM rockylinux:8 +LABEL maintainer="WSO2 Docker Maintainers " \ + com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v6.1.0.5" + +# Update the system to the specific 8.10 version +RUN dnf -y update && \ + dnf -y distro-sync && \ + dnf clean all + +# Install necessary locale packages +RUN yum install -y glibc-langpack-en && \ + yum install -y langpacks-en glibc-locale-source && \ + localedef -c -f UTF-8 -i en_US en_US.UTF-8 + +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 ca-certificates fontconfig gzip tar nc unzip wget \ + && yum clean all + +ENV JAVA_VERSION jdk-17.0.10+7 + +# Install JDK17 +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='a8fd07e1e97352e97e330beb20f1c6b351ba064ca7878e974c7d68b8a5c1b378'; \ + BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.10%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.10_7.tar.gz'; \ + ;; \ + aarch64|arm64) \ + ESUM='6e4201abfb3b020c1fb899b7ac063083c271250bf081f3aa7e63d91291a90b74'; \ + BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.10%2B7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.10_7.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 +ARG USER=wso2carbon +ARG USER_ID=802 +ARG USER_GROUP=wso2 +ARG USER_GROUP_ID=802 +ARG USER_HOME=/home/${USER} +# build arguments for WSO2 product installation +ARG WSO2_SERVER_NAME=wso2is +ARG WSO2_SERVER_VERSION=6.1.0 +ARG WSO2_SERVER_REPOSITORY=product-is +ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} +ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} +# Hosted wso2is-6.1.0 distribution URL. +ARG WSO2_SERVER_DIST_URL="" +# build arguments for external artifacts +ARG DNS_JAVA_VERSION=2.1.8 +ARG K8S_MEMBERSHIP_SCHEME_VERSION=1.0.10 +ARG MYSQL_CONNECTOR_VERSION=8.0.29 +# build argument for MOTD +ARG MOTD='printf "\n\ +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"' + +# 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 \ + && yum install -y \ + nc \ + unzip \ + wget \ + && rm -rf /var/cache/yum/* + +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 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 + +# Set the user and work directory. +USER ${USER_ID} +WORKDIR ${USER_HOME} + +# set environment variables +ENV JAVA_OPTS="-Djava.util.prefs.systemRoot=${USER_HOME}/.java -Djava.util.prefs.userRoot=${USER_HOME}/.java/.userPrefs" \ + WORKING_DIRECTORY=${USER_HOME} \ + WSO2_SERVER_HOME=${WSO2_SERVER_HOME} + +# expose ports +EXPOSE 4000 9763 9443 + +# initiate container and start WSO2 Carbon server +ENTRYPOINT ["/home/wso2carbon/docker-entrypoint.sh"] diff --git a/dockerfiles/jdk17/rocky/is/README.md b/dockerfiles/jdk17/rocky/is/README.md new file mode 100755 index 00000000..8411ed12 --- /dev/null +++ b/dockerfiles/jdk17/rocky/is/README.md @@ -0,0 +1,79 @@ +# Dockerfile for WSO2 Identity Server # + +This section defines the step-by-step instructions to build an [Rocky Linux](https://hub.docker.com/_/rockylinux) Linux based Docker image for WSO2 Identity Server `6.1.0`. + +## Prerequisites + +* [Docker](https://www.docker.com/get-docker) `v17.09.0` or above +* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) client + +## How to build an image and run + +##### 1. Checkout this repository into your local machine using the following Git client command. + +``` +git clone https://github.com/wso2/docker-is.git +``` + +>The local copy of the `dockerfiles/rocky/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards. + +##### 2. Build the Docker image. +- Navigate to `` directory.
+ Execute `docker build` command as shown below. + + `docker build -t wso2is:6.1.0-rocky .` + +> Configure the URL of hosted wso2is-6.1.0 distribution as WSO2_SERVER_DIST_URL. + +> Tip - If you require the container to run with a different UID and GID, pass the preferred values of the UID and GID +> as values for build arguments `USER_ID` and `USER_GROUP_ID` when building the image, as shown below. Note +> that setting lower values for the UID and GID is not recommended. ++ `docker build -t wso2is:6.1.0-rocky --build-arg USER_ID= --build-arg USER_GROUP_ID= .` + +##### 3. Running the Docker image. + +- `docker run -it -p 9443:9443 wso2is:6.1.0-rocky` + +>Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +You may map other container service ports, which have been exposed to Docker host ports, as desired. + +##### 4. Accessing management consoles. + +- To access the user interfaces, use the docker host IP and port 9443. + + Management Console: `https://:9443/console` + + User Portal: `https://:9443/myaccount` + +>In here, refers to hostname or IP of the host machine on top of which containers are spawned. + +## How to update configurations + +Configurations would lie on the Docker host machine and they can be volume mounted to the container.
+As an example, steps required to change the port offset using `deployment.toml` is as follows: + +##### 1. Stop the Identity Server container if it's already running. + +In WSO2 Identity Server version `6.1.0` product distribution, `deployment.toml` configuration file
+can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
+referred to as `/deployment.toml` and change the `[server] -> offset` value to 1. + +##### 2. Grant read permission to `other` users for `/deployment.toml`. + +``` +chmod o+r /deployment.toml +``` + +##### 3. Run the image by mounting the file to container as follows: + +``` +docker run \ +-p 9444:9444 \ +--volume /deployment.toml:/deployment.toml \ +wso2is:6.1.0-rocky +``` + +>In here, refers to /home/wso2carbon/wso2is-6.1.0/repository/conf folder of the container. + +## Docker command usage references + +* [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) +* [Docker run command reference](https://docs.docker.com/engine/reference/run/) +* [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) diff --git a/dockerfiles/jdk17/rocky/is/docker-entrypoint.sh b/dockerfiles/jdk17/rocky/is/docker-entrypoint.sh new file mode 100755 index 00000000..47c26446 --- /dev/null +++ b/dockerfiles/jdk17/rocky/is/docker-entrypoint.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# ------------------------------------------------------------------------ +# Copyright 2024 WSO2, LLC. (http://wso2.com) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +# ------------------------------------------------------------------------ + +set -e + +# volume mounts +config_volume=${WORKING_DIRECTORY}/wso2-config-volume +artifact_volume=${WORKING_DIRECTORY}/wso2-artifact-volume + +# check if the WSO2 non-root user home exists +test ! -d ${WORKING_DIRECTORY} && echo "WSO2 Docker non-root user home does not exist" && exit 1 + +# check if the WSO2 product home exists +test ! -d ${WSO2_SERVER_HOME} && echo "WSO2 Docker product home does not exist" && exit 1 + +# copy any configuration changes mounted to config_volume +test -d ${config_volume} && [ "$(ls -A ${config_volume})" ] && cp -RL ${config_volume}/* ${WSO2_SERVER_HOME}/ +# copy any artifact changes mounted to artifact_volume +test -d ${artifact_volume} && [ "$(ls -A ${artifact_volume})" ] && cp -RL ${artifact_volume}/* ${WSO2_SERVER_HOME}/ + +# start WSO2 Carbon server +sh ${WSO2_SERVER_HOME}/bin/wso2server.sh "$@" diff --git a/dockerfiles/rocky/is/Dockerfile b/dockerfiles/rocky/is/Dockerfile new file mode 100755 index 00000000..a05cb9ef --- /dev/null +++ b/dockerfiles/rocky/is/Dockerfile @@ -0,0 +1,144 @@ +# ------------------------------------------------------------------------ +# +# Copyright 2024 WSO2, LLC. (http://wso2.com) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +# +# ------------------------------------------------------------------------ + +# set base Docker image to Rocky Linux Docker image +FROM rockylinux:8 +LABEL maintainer="WSO2 Docker Maintainers " \ + com.wso2.docker.source="https://github.com/wso2/docker-is/releases/tag/v6.1.0.4" + +# Update the system to the specific 8.10 version +RUN dnf -y update && \ + dnf -y distro-sync && \ + dnf clean all + +# Install necessary locale packages +RUN yum install -y glibc-langpack-en && \ + yum install -y langpacks-en glibc-locale-source && \ + localedef -c -f UTF-8 -i en_US en_US.UTF-8 + +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 ca-certificates fontconfig gzip tar nc unzip wget \ + && yum clean all + +ENV JAVA_VERSION jdk-11.0.20.1+1 + +# Install JDK11 +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='398a64bff002f0e3b0c01ecd24a1a32c83cb72a5255344219e9757d4ddd9f857'; \ + BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.tar.gz'; \ + ;; \ + aarch64|arm64) \ + ESUM='69d39682c4a2fac294a9eaacbf62c26d3c8a2f9123f1b5d287498a5472c6b672'; \ + BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.20.1_1.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 +ARG USER=wso2carbon +ARG USER_ID=802 +ARG USER_GROUP=wso2 +ARG USER_GROUP_ID=802 +ARG USER_HOME=/home/${USER} +# build arguments for WSO2 product installation +ARG WSO2_SERVER_NAME=wso2is +ARG WSO2_SERVER_VERSION=6.1.0 +ARG WSO2_SERVER_REPOSITORY=product-is +ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} +ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} +# Hosted wso2is-6.1.0 distribution URL. +ARG WSO2_SERVER_DIST_URL="" +# build arguments for external artifacts +ARG DNS_JAVA_VERSION=2.1.8 +ARG K8S_MEMBERSHIP_SCHEME_VERSION=1.0.10 +ARG MYSQL_CONNECTOR_VERSION=8.0.29 +# build argument for MOTD +ARG MOTD='printf "\n\ +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"' + +# 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 \ + && yum install -y \ + nc \ + unzip \ + wget \ + && rm -rf /var/cache/yum/* + +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 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 + +# Set the user and work directory. +USER ${USER_ID} +WORKDIR ${USER_HOME} + +# set environment variables +ENV JAVA_OPTS="-Djava.util.prefs.systemRoot=${USER_HOME}/.java -Djava.util.prefs.userRoot=${USER_HOME}/.java/.userPrefs" \ + WORKING_DIRECTORY=${USER_HOME} \ + WSO2_SERVER_HOME=${WSO2_SERVER_HOME} + +# expose ports +EXPOSE 4000 9763 9443 + +# initiate container and start WSO2 Carbon server +ENTRYPOINT ["/home/wso2carbon/docker-entrypoint.sh"] diff --git a/dockerfiles/rocky/is/README.md b/dockerfiles/rocky/is/README.md new file mode 100755 index 00000000..887f2439 --- /dev/null +++ b/dockerfiles/rocky/is/README.md @@ -0,0 +1,79 @@ +# Dockerfile for WSO2 Identity Server # + +This section defines the step-by-step instructions to build an [Rocky Linux](https://hub.docker.com/_/rockylinux) Linux based Docker image for WSO2 Identity Server `6.1.0`. + +## Prerequisites + +* [Docker](https://www.docker.com/get-docker) `v17.09.0` or above +* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) client + +## How to build an image and run + +##### 1. Checkout this repository into your local machine using the following Git client command. + +``` +git clone https://github.com/wso2/docker-is.git +``` + +>The local copy of the `dockerfiles/rocky/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards. + +##### 2. Build the Docker image. +- Navigate to `` directory.
+ Execute `docker build` command as shown below. + + `docker build -t wso2is:6.1.0-rocky .` + +> Configure the URL of hosted wso2is-6.1.0 distribution as WSO2_SERVER_DIST_URL. + +> Tip - If you require the container to run with a different UID and GID, pass the preferred values of the UID and GID +> as values for build arguments `USER_ID` and `USER_GROUP_ID` when building the image, as shown below. Note +> that setting lower values for the UID and GID is not recommended. ++ `docker build -t wso2is:6.1.0-rocky --build-arg USER_ID= --build-arg USER_GROUP_ID= .` + +##### 3. Running the Docker image. + +- `docker run -it -p 9443:9443 wso2is:6.1.0-rocky` + +>Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +You may map other container service ports, which have been exposed to Docker host ports, as desired. + +##### 4. Accessing management consoles. + +- To access the user interfaces, use the docker host IP and port 9443. + + Management Console: `https://:9443/console` + + User Portal: `https://:9443/myaccount` + +>In here, refers to hostname or IP of the host machine on top of which containers are spawned. + +## How to update configurations + +Configurations would lie on the Docker host machine and they can be volume mounted to the container.
+As an example, steps required to change the port offset using `deployment.toml` is as follows: + +##### 1. Stop the Identity Server container if it's already running. + +In WSO2 Identity Server version `6.1.0` product distribution, `deployment.toml` configuration file
+can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
+referred to as `/deployment.toml` and change the `[server] -> offset` value to 1. + +##### 2. Grant read permission to `other` users for `/deployment.toml`. + +``` +chmod o+r /deployment.toml +``` + +##### 3. Run the image by mounting the file to container as follows: + +``` +docker run \ +-p 9444:9444 \ +--volume /deployment.toml:/deployment.toml \ +wso2is:6.1.0-rocky +``` + +>In here, refers to /home/wso2carbon/wso2is-6.1.0/repository/conf folder of the container. + +## Docker command usage references + +* [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) +* [Docker run command reference](https://docs.docker.com/engine/reference/run/) +* [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) diff --git a/dockerfiles/rocky/is/docker-entrypoint.sh b/dockerfiles/rocky/is/docker-entrypoint.sh new file mode 100755 index 00000000..47c26446 --- /dev/null +++ b/dockerfiles/rocky/is/docker-entrypoint.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# ------------------------------------------------------------------------ +# Copyright 2024 WSO2, LLC. (http://wso2.com) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +# ------------------------------------------------------------------------ + +set -e + +# volume mounts +config_volume=${WORKING_DIRECTORY}/wso2-config-volume +artifact_volume=${WORKING_DIRECTORY}/wso2-artifact-volume + +# check if the WSO2 non-root user home exists +test ! -d ${WORKING_DIRECTORY} && echo "WSO2 Docker non-root user home does not exist" && exit 1 + +# check if the WSO2 product home exists +test ! -d ${WSO2_SERVER_HOME} && echo "WSO2 Docker product home does not exist" && exit 1 + +# copy any configuration changes mounted to config_volume +test -d ${config_volume} && [ "$(ls -A ${config_volume})" ] && cp -RL ${config_volume}/* ${WSO2_SERVER_HOME}/ +# copy any artifact changes mounted to artifact_volume +test -d ${artifact_volume} && [ "$(ls -A ${artifact_volume})" ] && cp -RL ${artifact_volume}/* ${WSO2_SERVER_HOME}/ + +# start WSO2 Carbon server +sh ${WSO2_SERVER_HOME}/bin/wso2server.sh "$@"