From ce3f87b277312b3a51f5171007677c3468247559 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 5 Jun 2020 09:33:32 +0800 Subject: [PATCH] squash: bin-aio UP up content errExit, up build_img.sh --build-arg TAG=$version up df up df up ## quick builds export NOCAHE="--no-cache" 8.5.55 u nexus-2.7.1-01-bundle_repack.tar.gz --- binary/README.md | 10 +++++++ binary/bin-aio/Dockerfile | 12 +++------ binary/bin-aio/build.sh | 55 +++++++++++++++++++++++++++------------ build_img.sh | 24 ++++++++++++----- 4 files changed, 70 insertions(+), 31 deletions(-) diff --git a/binary/README.md b/binary/README.md index 7a7bf6b..b3ffe67 100644 --- a/binary/README.md +++ b/binary/README.md @@ -11,3 +11,13 @@ merge aio, with diff tags - bin-aio: - bin-aio: - bin-aio: + +## quick builds + +```bash +./build_img.sh bin-aio push hotspot-8u202 +./build_img.sh bin-aio push zulu-8u252 +./build_img.sh bin-aio push nexus-v271 +./build_img.sh bin-aio push tomcat-v8.5.55 + +``` \ No newline at end of file diff --git a/binary/bin-aio/Dockerfile b/binary/bin-aio/Dockerfile index 9da3830..04bd81d 100644 --- a/binary/bin-aio/Dockerfile +++ b/binary/bin-aio/Dockerfile @@ -1,15 +1,11 @@ ARG repo=docker.io FROM ${repo}/infrastlabs/alpine-ext - -ARG url=http://10.1.1.114:680/temp_trans/pro_env -ARG src=jdk-8u162-linux-x64.tar.gz -ARG dest=/down -#/jdk-8u162 +ARG TAG USER root -RUN wget --user=root --password=root $url/$src \ - && mkdir -p $dest && tar -zxf $src -C $dest \ - && rm -f $src +RUN echo $TAG +ADD *.sh / +RUN sh /build.sh diff --git a/binary/bin-aio/build.sh b/binary/bin-aio/build.sh index 1698175..f354402 100644 --- a/binary/bin-aio/build.sh +++ b/binary/bin-aio/build.sh @@ -1,29 +1,52 @@ #!/usr/bin/env bash -url=http://10.1.1.114:680/temp_trans/pro_env +# https://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.55/bin/apache-tomcat-8.5.55.tar.gz + + +url=http://172.25.23.190/repo3-env +AUTH=root:root dest=/down function down(){ local src=$1 - wget --user=root --password=root $url/$src + curl -g -u $AUTH $url/$src > $src #-g with [] mkdir -p $dest && tar -zxf $src -C $dest - rm -f $src -} - -#TODO case > switch($tag) -# hotspot, zulu, nexus, tomcat -src=jdk-8u162-linux-x64.tar.gz -$down $src - -src=zulu-xxx.tar.gz -$down $src + rm -f $src -src=nexus-2.7.1-01-bundle.tar.gz -$down $src + tree -L 2 $dest/ +} -src=apache-tomcat-8.0.51.tar.gz -$down $src +#case > switch($TAG) +echo "TAG: $TAG" +cmd=`echo $TAG |cut -d'-' -f1` +echo "cmd: $cmd" +# hotspot, zulu, nexus, tomcat +case "$cmd" in + # OpenJDK8U-jdk_x64_linux_openj9_8u252b09_openj9-0.20.0.tar.gz + hotspot) + down "jdk-8u202-linux-x64.tar.gz" + ;; + zulu) + down "zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz" + ;; + nexus) + down "nexus-2.7.1-01-bundle_repack.tar.gz" + ;; + tomcat) + down "apache-tomcat-8.5.55.tar.gz" + ;; + all) #all in one? + # $down jdk-8u162-linux-x64.tar.gz + # $down zulu-xxx.tar.gz + # $down nexus-2.7.1-01-bundle.tar.gz + # $down apache-tomcat-8.0.51.tar.gz + ;; + *) + echo "error: TAG preffix not mactch, please check you tag." + exit 2 + ;; +esac rm -f /build.sh \ No newline at end of file diff --git a/build_img.sh b/build_img.sh index 4a4033f..ee4b8d2 100755 --- a/build_img.sh +++ b/build_img.sh @@ -1,37 +1,45 @@ #!/bin/bash #setenforce 0 cur_path=$(cd "$(dirname "$0")"; pwd) #&& echo $cur_path -cmd=$1 && push=$2 && ver=$3 -printf "entry params: [%s, %s, %s]\n" $cmd $push $ver +cmd=$1 && push=$2 && ver=$3 #push before ver: +printf "entry params[cmd/push/ver]: [%s, %s, %s]\n" $cmd $push $ver source /etc/profile export |grep DOCKER_REG # repo=docker.io repo=registry.cn-shenzhen.aliyuncs.com -echo "${DOCKER_REGISTRY_PW_infrastSubAcc2}" |docker login --username=${DOCKER_REGISTRY_USER_infrastSubAcc2} --password-stdin $repo +echo "${DOCKER_REGISTRY_PW_infrastSubUser2}" |docker login --username=${DOCKER_REGISTRY_USER_infrastSubUser2} --password-stdin $repo + +function errExit(){ + echo "error: $@" + exit 1 +} function buildPushImg(){ local ns=$1 local image=$2 local push=$3 local version=$ver #$4 + red1="\033[31m" && red2="\033[0m" if [ "" = "$version" ]; then version=latest fi - echo ">>>==============={{ "$image" }}>>>build:=========================================" - docker build --pull -t $repo/$namespace/$image:$version --build-arg repo=$repo . + # NOCAHE="--no-cache" + echo -e ">>>==============={{ ${red1}$image${red2} }}>>>build:=========================================" + docker build $NOCAHE --pull -t $repo/$ns/$image:$version --build-arg repo=$repo --build-arg TAG=$version . if [ "push" = "$push" ]; then - echo ">>>==============={{ "$image" }}>>>push:=========================================" - docker push $repo/$namespace/$image:$version + echo -e ">>>==============={{ ${red1}$image${red2} }}>>>push:=========================================" + docker push $repo/$ns/$image:$version fi } function doOne(){ local mod=$1 && local ns=$2 && echo $ns + test -z $mod && errExit "must buile with one module!" #special array=( @@ -80,4 +88,6 @@ function callType(){ ;; esac } + +#export NOCAHE="--no-cache" callType $cmd