mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
support custom docker tag
This commit is contained in:
@@ -5,6 +5,7 @@ RELEASE=${RELEASE_BUILD:-"0"};
|
|||||||
VERSION=""
|
VERSION=""
|
||||||
COMMIT_HASH=""
|
COMMIT_HASH=""
|
||||||
BUILD_UNIXTIME=""
|
BUILD_UNIXTIME=""
|
||||||
|
DOCKER_TAG=""
|
||||||
|
|
||||||
echo_red() {
|
echo_red() {
|
||||||
printf '\033[31m%s\033[0m\n' "$1"
|
printf '\033[31m%s\033[0m\n' "$1"
|
||||||
@@ -34,6 +35,7 @@ Types:
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
-r, --release Build release (The script will use environment variable "RELEASE_BUILD" to detect whether this is release building by default)
|
-r, --release Build release (The script will use environment variable "RELEASE_BUILD" to detect whether this is release building by default)
|
||||||
|
-t, --tag Docker tag (For "docker" type only)
|
||||||
-h, --help Show help
|
-h, --help Show help
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -49,6 +51,10 @@ parse_args() {
|
|||||||
--release | -r)
|
--release | -r)
|
||||||
RELEASE="1"
|
RELEASE="1"
|
||||||
;;
|
;;
|
||||||
|
--tag | -t)
|
||||||
|
DOCKER_TAG="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--help | -h)
|
--help | -h)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
@@ -123,9 +129,15 @@ build_docker() {
|
|||||||
docker_tag="SNAPSHOT-$(date '+%Y%m%d')";
|
docker_tag="SNAPSHOT-$(date '+%Y%m%d')";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building docker image \"ezbookkeeping:$docker_tag\"..."
|
docker_tag="ezbookkeeping:$docker_tag"
|
||||||
|
|
||||||
docker build . -t "ezbookkeeping:$docker_tag" --build-arg RELEASE_BUILD=$RELEASE
|
if [ -n "$DOCKER_TAG" ]; then
|
||||||
|
docker_tag="$DOCKER_TAG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building docker image \"$docker_tag\"..."
|
||||||
|
|
||||||
|
docker build . -t "$docker_tag" --build-arg RELEASE_BUILD=$RELEASE
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user