Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit f7c2314

Browse files
docker: make build- and push-image scripts more verbose
1 parent 3efec23 commit f7c2314

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

utils/docker/images/build-image.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ function usage {
4949
"current directory."
5050
}
5151

52-
# Check if the first and second argument is nonempty
53-
if [[ -z "$1" || -z "$2" ]]; then
52+
echo "Check if the first and second argument are nonempty: \"${1}\", \"${2}\""
53+
if [[ -z "${1}" || -z "${2}" ]]; then
5454
usage
5555
exit 1
5656
fi
5757

58-
# Check if the file Dockerfile.OS-VER exists
58+
echo "Check if the file Dockerfile.${1}-${2} exists"
5959
if [[ ! -f "Dockerfile.$2" ]]; then
6060
echo "ERROR: wrong argument."
6161
usage
6262
exit 1
6363
fi
6464

65-
# Build a Docker image tagged with ${DOCKERHUB_REPO}:1.6-OS-VER
65+
echo "Build a Docker image tagged with ${DOCKERHUB_REPO}:1.6-${1}-${2}"
6666
docker build -t $1:1.6-$2 \
6767
--build-arg http_proxy=$http_proxy \
6868
--build-arg https_proxy=$https_proxy \

utils/docker/images/push-image.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,24 @@ function usage {
4949
"locally."
5050
}
5151

52-
# Check if the first argument is nonempty
53-
if [[ -z "$1" ]]; then
52+
OS__OS_VER=${1}
53+
echo "Check if the first argument (OS-VER) is nonempty: \"${OS__OS_VER}\""
54+
if [[ -z "${OS__OS_VER}" ]]; then
5455
usage
5556
exit 1
5657
fi
5758

58-
# Check if the image tagged with ${DOCKERHUB_REPO}:1.6-OS-VER exists locally
59-
if [[ ! $(docker images -a | awk -v pattern="^${DOCKERHUB_REPO}:1.6-$1\$" \
59+
echo "Check if the image tagged with ${DOCKERHUB_REPO}:1.6-${OS__OS_VER} exists locally"
60+
if [[ ! $(docker images -a | awk -v pattern="^${DOCKERHUB_REPO}:1.6-${OS__OS_VER}\$" \
6061
'$1":"$2 ~ pattern') ]]
6162
then
6263
echo "ERROR: wrong argument."
6364
usage
6465
exit 1
6566
fi
6667

67-
# Log in to the Docker Hub
68+
echo "Log in to the Docker Hub"
6869
docker login -u="$DOCKERHUB_USER" -p="$DOCKERHUB_PASSWORD"
6970

70-
# Push the image to the repository
71+
echo "Push the image to the repository"
7172
docker push ${DOCKERHUB_REPO}:1.6-$1

0 commit comments

Comments
 (0)