@@ -18,7 +18,7 @@ usage: $0 [CMD] [OPTIONS]
1818 push Push the docker image to Docker Hub
1919
2020 OPTIONS:
21- -os=OS_NAME Choose beween centos7 (default), ubuntu20.04 and ubuntu22.04.
21+ -os=OS_NAME Choose beween ubuntu20.04 and ubuntu22.04 (default) .
2222 -target=TARGET Choose target fo the Docker image:
2323 'dev': os + packages to compile app
2424 'builder': os + packages to compile app +
@@ -39,9 +39,6 @@ _setup() {
3939 commitSha=" $( git rev-parse HEAD) "
4040 commitSha=" $( echo " $commitSha " | tr -cd ' a-zA-Z0-9-' ) "
4141 case " ${os} " in
42- " centos7" )
43- osBaseImage=" centos:centos7"
44- ;;
4542 " ubuntu20.04" )
4643 osBaseImage=" ubuntu:20.04"
4744 ;;
@@ -54,13 +51,12 @@ _setup() {
5451 ;;
5552 esac
5653 imageName=" ${IMAGE_NAME_OVERRIDE:- " ${org} /flow-${os} -${target} " } "
57- if [[ " ${useCommitSha} " == " yes" ]]; then
58- imageTag=" ${commitSha} "
59- else
60- imageTag=" latest"
54+ imageTag=" ${commitSha} "
55+ if [[ " ${tag} " != " NONE" ]]; then
56+ imageTag=" ${tag} "
6157 fi
6258 case " ${target} " in
63- " builder" )
59+ " builder" | " master " )
6460 fromImage=" ${FROM_IMAGE_OVERRIDE:- " ${org} /flow-${os} -dev" } :${imageTag} "
6561 context=" ."
6662 buildArgs=" --build-arg numThreads=${numThreads} "
@@ -83,26 +79,49 @@ _setup() {
8379
8480_create () {
8581 echo " Create docker image ${imagePath} using ${file} "
86- echo $buildArgs
87- docker build --file " ${file} " --tag " ${imagePath} " ${buildArgs} " ${context} " --progress plain
82+ docker build \
83+ --file " ${file} " \
84+ --tag " ${imagePath} " \
85+ ${buildArgs} \
86+ " ${context} " \
87+ --progress plain
8888 rm -f etc/InstallerOpenROAD.sh
8989}
9090
9191_push () {
92+ if [[ -z ${username+x} ]]; then
93+ echo " Missing required -username=<USER> argument"
94+ exit 1
95+ fi
96+ if [[ -z ${password+x} ]]; then
97+ echo " Missing required -password=<PASS> argument"
98+ exit 1
99+ fi
100+ docker login --username ${username} --password ${password}
101+ if [[ " ${tag} " == " NONE" ]]; then
102+ tag=" latest"
103+ fi
104+ mkdir -p build
92105 case " ${target} " in
93106 " dev" )
94- mkdir -p build
95- docker login --username ${username} --password ${password}
96- if [[ " ${useCommitSha} " == " yes" ]]; then
97- ./etc/DockerHelper.sh create -os=${os} -ci -target=dev -sha \
98- 2>&1 | tee build/create-${os} -${commitSha} .log
99- docker push openroad/flow-${os} -dev:${commitSha}
100- else
101- ./etc/DockerHelper.sh create -os=${os} -ci -target=dev \
102- 2>&1 | tee build/create-${os} -${tag} .log
103- docker push openroad/flow-${os} -dev:${tag}
104- fi
107+ ./etc/DockerHelper.sh create -os=${os} -ci -target=${target} \
108+ 2>&1 | tee build/create-${os} -${target} -${tag} .log
109+ docker push ${imagePath}
105110 ;;
111+
112+ " master" )
113+ # Create dev image needed as a base for builder image
114+ ./etc/DockerHelper.sh create -os=${os} -target=dev \
115+ 2>&1 | tee build/create-${os} -dev-${target} -${tag} .log
116+ # Create builder image
117+ ./etc/DockerHelper.sh create -os=${os} -target=builder \
118+ 2>&1 | tee build/create-${os} -${target} -${tag} .log
119+ docker push ${org} /flow-${os} -dev:${commitSha}
120+ docker push ${org} /flow-${os} -dev:${commitSha} ${org} /flow-${os} -dev:latest
121+ docker push ${org} /flow-${os} -builder:${commitSha} ${org} /orfs:${commitSha}
122+ docker push ${org} /flow-${os} -builder:${commitSha} ${org} /orfs:${tag}
123+ ;;
124+
106125 * )
107126 echo " Target ${target} is not valid candidate for push to DockerHub." >&2
108127 _help
@@ -134,11 +153,10 @@ if [[ -z $(command -v "${_rule}") ]]; then
134153fi
135154
136155# default values, can be overwritten by cmdline args
137- os=" centos7 "
156+ os=" ubuntu22.04 "
138157target=" dev"
139- useCommitSha=" no"
140158numThreads=" -1"
141- tag=" latest "
159+ tag=" NONE "
142160options=" "
143161
144162while [ " $# " -gt 0 ]; do
@@ -155,9 +173,6 @@ while [ "$#" -gt 0 ]; do
155173 -threads=* )
156174 numThreads=" ${1#* =} "
157175 ;;
158- -sha )
159- useCommitSha=yes
160- ;;
161176 -ci )
162177 options=" -ci"
163178 ;;
0 commit comments