Skip to content

Commit

Permalink
squash: bin-aio
Browse files Browse the repository at this point in the history
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
  • Loading branch information
huapox committed Jun 5, 2020
1 parent 5faa059 commit ce3f87b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 31 deletions.
10 changes: 10 additions & 0 deletions binary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
12 changes: 4 additions & 8 deletions binary/bin-aio/Dockerfile
Original file line number Diff line number Diff line change
@@ -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



55 changes: 39 additions & 16 deletions binary/bin-aio/build.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 17 additions & 7 deletions build_img.sh
Original file line number Diff line number Diff line change
@@ -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=(
Expand Down Expand Up @@ -80,4 +88,6 @@ function callType(){
;;
esac
}

#export NOCAHE="--no-cache"
callType $cmd

0 comments on commit ce3f87b

Please sign in to comment.