From a11b4af2487defd9da017ae40a6d27b809ca0471 Mon Sep 17 00:00:00 2001 From: Li Zhanhui Date: Thu, 19 Oct 2023 21:07:59 +0800 Subject: [PATCH] feat: build docker image for broker Signed-off-by: Li Zhanhui --- distribution/bin/start-broker.sh | 2 +- distribution/docker/Dockerfile | 4 ++++ distribution/docker/build.sh | 27 +++++++++++++++++++++++++++ distribution/pom.xml | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 distribution/docker/Dockerfile create mode 100755 distribution/docker/build.sh diff --git a/distribution/bin/start-broker.sh b/distribution/bin/start-broker.sh index b023613fb..ac031bdca 100755 --- a/distribution/bin/start-broker.sh +++ b/distribution/bin/start-broker.sh @@ -17,5 +17,5 @@ # SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -DIST_DIR="$(dirname "SCRIPT_DIR")" +DIST_DIR="$(dirname "$SCRIPT_DIR")" "$SCRIPT_DIR"/run-server.sh com.automq.rocketmq.broker.BrokerStartup -c "$DIST_DIR/conf/broker.yaml" \ No newline at end of file diff --git a/distribution/docker/Dockerfile b/distribution/docker/Dockerfile new file mode 100644 index 000000000..439db5a05 --- /dev/null +++ b/distribution/docker/Dockerfile @@ -0,0 +1,4 @@ +FROM amazoncorretto:21 +WORKDIR /root +ADD rocketmq-on-s3.tar.gz . +CMD ["/root/rocketmq-on-s3/bin/start-broker.sh"] \ No newline at end of file diff --git a/distribution/docker/build.sh b/distribution/docker/build.sh new file mode 100755 index 000000000..d8a9bb01b --- /dev/null +++ b/distribution/docker/build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env 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. +# + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +REPO_DIR=$(dirname "$(dirname "$SCRIPT_DIR")") +cd "$REPO_DIR" || exit 1 +mvn package -Dmaven.test.skip=true +cp distribution/target/rocketmq-on-s3.tar.gz "$SCRIPT_DIR" +cd "$SCRIPT_DIR" || exit 1 +docker build -t rocketmq-on-s3:"$(uname -m)"-0.0.1 -f Dockerfile . + + diff --git a/distribution/pom.xml b/distribution/pom.xml index 0014189b3..7886dfc29 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -61,6 +61,6 @@ - rocketmq-on-s3-${project.version} + rocketmq-on-s3 \ No newline at end of file