From d0d177a32d1f112f47d17122a19a98ea09bb10d2 Mon Sep 17 00:00:00 2001 From: Vivek Vinushanth Christopher <32198547+VivekVinushanth@users.noreply.github.com> Date: Mon, 15 Aug 2022 17:06:31 +0530 Subject: [PATCH] Update 6.0.x docker file (#351) * Add U2 wget logic * Update centos Dockerfile * Address comments --- dockerfiles/alpine/is/Dockerfile | 15 ++++++++------- dockerfiles/alpine/is/README.md | 10 ++++------ dockerfiles/centos/is/Dockerfile | 14 +++++++------- dockerfiles/centos/is/README.md | 10 ++++------ dockerfiles/ubuntu/is/Dockerfile | 15 ++++++++------- dockerfiles/ubuntu/is/README.md | 11 ++++------- 6 files changed, 35 insertions(+), 40 deletions(-) diff --git a/dockerfiles/alpine/is/Dockerfile b/dockerfiles/alpine/is/Dockerfile index d647b2fe..49cfccb4 100755 --- a/dockerfiles/alpine/is/Dockerfile +++ b/dockerfiles/alpine/is/Dockerfile @@ -70,6 +70,8 @@ ARG WSO2_SERVER_VERSION=6.0.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.0.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.9 @@ -106,14 +108,9 @@ RUN \ && apk add unzip \ && apk add wget -## set the user and work directory -USER ${USER_ID} -WORKDIR ${USER_HOME} - -COPY --chown=wso2carbon:wso2 ${WSO2_SERVER}.zip ${USER_HOME}/ - RUN \ - unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \ + 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 @@ -123,6 +120,10 @@ ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/rel # add MySQL JDBC connector to server home as a third party library 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/ +# set the user and work directory +USER ${USER_ID} +WORKDIR ${USER_HOME} + # set environment variables ENV WORKING_DIRECTORY=${USER_HOME} \ WSO2_SERVER_HOME=${WSO2_SERVER_HOME} diff --git a/dockerfiles/alpine/is/README.md b/dockerfiles/alpine/is/README.md index feef6560..19ba124e 100755 --- a/dockerfiles/alpine/is/README.md +++ b/dockerfiles/alpine/is/README.md @@ -17,28 +17,26 @@ git clone https://github.com/wso2/docker-is.git >The local copy of the `dockerfiles/alpine/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards. -##### 2. Copy the `wso2is-6.0.0.zip` to the `docker-is/dockerfiles/alpine/is` directory - -##### 3. Build the Docker image. +##### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. + `docker build -t wso2is:6.0.0-alpine .` -> By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. +> Configure the URL of hosted wso2is-6.0.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.0.0-alpine --build-arg USER_ID= --build-arg USER_GROUP_ID= .` -##### 4. Running the Docker image. +##### 3. Running the Docker image. - `docker run -it -p 9443:9443 wso2is:5.11.0-alpine` >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. -##### 5. Accessing management consoles. +##### 4. Accessing management consoles. - To access the user interfaces, use the docker host IP and port 9443. + Management Console: `https://:9443/console` diff --git a/dockerfiles/centos/is/Dockerfile b/dockerfiles/centos/is/Dockerfile index 7e3030e2..b1f992f3 100755 --- a/dockerfiles/centos/is/Dockerfile +++ b/dockerfiles/centos/is/Dockerfile @@ -65,6 +65,8 @@ ARG WSO2_SERVER_VERSION=6.0.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.0.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.9 @@ -102,14 +104,9 @@ RUN \ wget \ && rm -rf /var/cache/yum/* -## set the user and work directory -USER ${USER_ID} -WORKDIR ${USER_HOME} - -COPY --chown=wso2carbon:wso2 ${WSO2_SERVER}.zip ${USER_HOME}/ - RUN \ - unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \ + 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 @@ -119,6 +116,9 @@ ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/rel # add MySQL JDBC connector to server home as a third party library 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/ +# set the user and work directory +USER ${USER_ID} +WORKDIR ${USER_HOME} # set environment variables ENV WORKING_DIRECTORY=${USER_HOME} \ diff --git a/dockerfiles/centos/is/README.md b/dockerfiles/centos/is/README.md index 7b590eb6..56473dfb 100755 --- a/dockerfiles/centos/is/README.md +++ b/dockerfiles/centos/is/README.md @@ -17,28 +17,26 @@ git clone https://github.com/wso2/docker-is.git >The local copy of the `dockerfiles/centos/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards. -##### 2. Copy the `wso2is-6.0.0.zip` to the `docker-is/dockerfiles/centos/is` directory - -##### 3. Build the Docker image. +##### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. + `docker build -t wso2is:6.0.0-centos .` -> By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. +> Configure the URL of hosted wso2is-6.0.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:5.11.0-centos --build-arg USER_ID= --build-arg USER_GROUP_ID= .` -##### 4. Running the Docker image. +##### 3. Running the Docker image. - `docker run -it -p 9443:9443 wso2is:6.0.0-centos` >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. -##### 5. Accessing management consoles. +##### 4. Accessing management consoles. - To access the user interfaces, use the docker host IP and port 9443. + Management Console: `https://:9443/console` diff --git a/dockerfiles/ubuntu/is/Dockerfile b/dockerfiles/ubuntu/is/Dockerfile index bdc2dbfa..a78ec12e 100755 --- a/dockerfiles/ubuntu/is/Dockerfile +++ b/dockerfiles/ubuntu/is/Dockerfile @@ -66,6 +66,8 @@ ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2is ARG WSO2_SERVER_VERSION=6.0.0 +# hosted wso2is-6.0.0 distribution URL +ARG WSO2_SERVER_DIST_URL="" ARG WSO2_SERVER_REPOSITORY=product-is ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} @@ -107,14 +109,9 @@ RUN \ wget \ && rm -rf /var/lib/apt/lists/* -## set the user and work directory -USER ${USER_ID} -WORKDIR ${USER_HOME} - -COPY --chown=wso2carbon:wso2 ${WSO2_SERVER}.zip ${USER_HOME}/ - RUN \ - unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \ + 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 @@ -124,6 +121,10 @@ ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/rel # add MySQL JDBC connector to server home as a third party library 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/ +# 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} \ diff --git a/dockerfiles/ubuntu/is/README.md b/dockerfiles/ubuntu/is/README.md index cd162921..e3493632 100755 --- a/dockerfiles/ubuntu/is/README.md +++ b/dockerfiles/ubuntu/is/README.md @@ -7,7 +7,6 @@ based Docker image for WSO2 Identity Server `6.0.0`. * [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 -* wso2is-6.0.0.zip pack ## How to build an image and run @@ -19,29 +18,27 @@ git clone https://github.com/wso2/docker-is.git >The local copy of the `dockerfiles/ubuntu/is` directory will be referred to as `IS_DOCKERFILE_HOME` from this point onwards. -##### 2. Copy the `wso2is-6.0.0.zip` to the `docker-is/dockerfiles/ubuntu/is` directory - -##### 3. Build the Docker image. +##### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. + `docker build -t wso2is:6.0.0 .` -> By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. +> Configure the URL of hosted wso2is-6.0.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.0.0 --build-arg USER_ID= --build-arg USER_GROUP_ID= .` -##### 4. Running the Docker image. +##### 3. Running the Docker image. - `docker run -it -p 9443:9443 wso2is:6.0.0` >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. -##### 5. Accessing management consoles. +##### 4. Accessing management consoles. - To access the user interfaces, use the docker host IP and port 9443. + Management Console: `https://:9443/console`