This is an automated email from the ASF dual-hosted git repository.

vongosling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-docker.git

commit a06fdd1aa23889af3594e8889b8d9bb5718349a8
Author: liuruiyiyang <245422...@qq.com>
AuthorDate: Thu Aug 8 13:57:40 2019 +0800

    Feat(update.sh): add script to update official docker image repository
---
 README.md             | 10 ++++++++++
 image-build/update.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/README.md b/README.md
index 40fa54c..c080eab 100644
--- a/README.md
+++ b/README.md
@@ -120,6 +120,15 @@ docker run -d -p 10911:10911 -p 10909:10909 -v 
`pwd`/data/broker/logs:/root/logs
 
 ```
 
+### How to update RocketMQ image repository using update.sh
+Run:
+
+```
+./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 +240,7 @@ services:
     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..2123094
--- /dev/null
+++ b/image-build/update.sh
@@ -0,0 +1,54 @@
+#!/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
+}
+
+if [ $# -lt 1 ]; then
+    echo -e "Usage: sh $0 Repository"
+    exit -1
+fi
+
+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

Reply via email to