Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[script] feature update build.sh and Dockerfile: detect app version a… #1162

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion script/docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM openjdk:11.0.16-jre-slim-buster

# add args version
ARG VERSION

MAINTAINER tancloud "tomsun28@outlook.com"

# Install SSH
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd

ADD hertzbeat-1.3.2.tar /opt/
ADD hertzbeat-${VERSION}.tar /opt/

ENV TZ=Asia/Shanghai
#ENV LANG=zh_CN.UTF-8
Expand Down
23 changes: 12 additions & 11 deletions script/docker/server/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
# 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.

VERSION="$1"

if [ ! -n "$VERSION" ]; then
echo "MUST INPUT THE BUILD VERSION"
exit 1
fi

# 调整脚本目录
cd `dirname $0`
# 当前脚本目录
CURRENT_DIR=`pwd`

# 跳转制品目录
cd ../../../manager/target
# 自动捕获hertzbeat版本
VERSION=`ls *.tar| awk -F"-" '{print $2}' | awk -F".tar" '{print $1}'`
# 强制使用版本参数
if [ -n "$1" ]; then
VERSION="$1";
fi

# 编译上下文目录
CONTEXT_DIR=`pwd`

echo "docker build -t tancloud/hertzbeat:$VERSION -f $CURRENT_DIR/Dockerfile $CONTEXT_DIR"
echo "docker build -t tancloud/hertzbeat:$VERSION -f $CURRENT_DIR/Dockerfile $CONTEXT_DIR --build-arg VERSION="$VERSION""

docker build -t tancloud/hertzbeat:"$VERSION" -f $CURRENT_DIR/Dockerfile $CONTEXT_DIR
docker build -t tancloud/hertzbeat:"$VERSION" -f $CURRENT_DIR/Dockerfile $CONTEXT_DIR --build-arg VERSION="$VERSION"
#docker build -t tancloud/hertzbeat:latest -f $CURRENT_DIR/Dockerfile $CONTEXT_DIR --build-arg VERSION="$VERSION"