Merge remote-tracking branch 'upstream/master' into fix_issue7
diff --git a/README.md b/README.md
index 40fa54c..064f259 100644
--- a/README.md
+++ b/README.md
@@ -120,6 +120,16 @@
 
 ```
 
+### How to update RocketMQ image repository using update.sh
+Run:
+
+```
+cd image-build
+./update.sh 
+```
+
+This script will get the latest release version of RocketMQ and build the docker images based on ```alpine``` and ```centos``` respectively, then push the new images to the current official repository ```rocketmqinc/rocketmq```.
+
 ### How to verify RocketMQ works well
 
 #### Verify with Docker and docker-compose
@@ -231,6 +241,7 @@
     ports:
       - 10909:10909
       - 10911:10911
+      - 10912:10912
     volumes:
       - ./data/broker/logs:/home/rocketmq/logs
       - ./data/broker/store:/home/rocketmq/store
diff --git a/image-build/update.sh b/image-build/update.sh
new file mode 100755
index 0000000..ff84e86
--- /dev/null
+++ b/image-build/update.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+checkVersion()
+{
+    echo "Version = $1"
+	echo $1 |grep -E "^[0-9]+\.[0-9]+\.[0-9]+" > /dev/null
+    if [ $? = 0 ]; then
+        return 0
+    fi
+
+	echo "Version $1 illegal, it should be X.X.X format(e.g. 4.5.0), please check released versions in 'https://dist.apache.org/repos/dist/release/rocketmq/'"
+    exit -1
+}
+
+set -eu;
+
+# Update the image of the latest released version
+LATEST_VERSION=$(curl -s https://dist.apache.org/repos/dist/release/rocketmq/ | grep -B1 "KEYS" | grep -v "KEYS" | awk -F '>' '{print $3}' | awk -F '/' '{print $1}')
+
+checkVersion ${LATEST_VERSION}
+
+baseImages=("alpine" "centos")
+
+for baseImage in ${baseImages[@]}
+do
+    echo "Building image of version ${LATEST_VERSION}, base-image ${baseImage}"
+    bash build-image.sh ${LATEST_VERSION} ${baseImage}
+    if [ "${baseImage}" = "centos" ];then
+        TAG=${LATEST_VERSION}
+    else
+        TAG=${LATEST_VERSION}-${baseImage}
+    fi
+    docker push rocketmqinc/rocketmq:${TAG}
+done