Update Dockerfile for micro-gateway toolkit
-#
-# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+#Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
FROM adoptopenjdk/openjdk8:jdk8u222-b10-alpine
+LABEL maintainer="<dev@wso2.org>"
-#copy java and micro-gw tool kit
-# COPY ./files/jdk1.8.0_* /java
-ADD ./files/wso2am-micro-gw-toolkit-linux-3.1.0-beta /wso2am-micro-gw-toolkit-linux-3.1.0-beta
-
-# set environment variables
-# ENV JAVA_HOME=/java
-# ENV PATH=$JAVA_HOME/bin:$PATH
-
-ENV BAL_HOME=/wso2am-micro-gw-toolkit-linux-3.1.0-beta
-ENV PATH=$BAL_HOME/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=wso2am-micro-gw-toolkit-linux
+ARG WSO2_SERVER_VERSION=3.1.0-beta
+ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
+ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
+ARG WSO2_SERVER_DIST_URL=https://github.com/wso2/product-microgateway/releases/download/v${WSO2_SERVER_VERSION}/${WSO2_SERVER}.zip
+# 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"'
+ENV ENV=${USER_HOME}"/.ashrc"
+# create the non-root user and group and set MOTD login message
+RUN \
+ addgroup -S -g ${USER_GROUP_ID} ${USER_GROUP} \
+ && adduser -S -u ${USER_ID} -h ${USER_HOME} -G ${USER_GROUP} ${USER} \
+ && echo ${MOTD} > "${ENV}"
+# install required packages
+RUN \
+ apk add --no-cache \
+ bash \
+ libxml2-utils \
+ netcat-openbsd
+# add the WSO2 product distribution to user's home directory
+RUN \
+ wget --no-check-certificate -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
+ENV PATH ${WSO2_SERVER_HOME}/bin:$PATH
\ No newline at end of file
