Skip to content

Commit

Permalink
Add a --skip-build option to docker image builds (#23836)
Browse files Browse the repository at this point in the history
* add a skip-build argument to build.sh, to allow pushing without building, assuming an image is already built

* Restyle

* Fix conditional
  • Loading branch information
andy31415 authored and pull[bot] committed Aug 30, 2023
1 parent 25bb365 commit 1507444
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions integrations/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ fi
Build and (optionally tag as latest, push) a docker image from Dockerfile in CWD
Options:
--no-cache passed as a docker build argument
--latest update latest to the current built version (\"$VERSION\")
--push push image(s) to docker.io (requires docker login for \"$ORG\")
--help get this message
--squash squash docker layers before push them to docker.io (requires docker-squash python module)
--no-cache passed as a docker build argument
--latest update latest to the current built version (\"$VERSION\")
--push push image(s) to docker.io (requires docker login for \"$ORG\")
--skip-build skip the build/prune step
--help get this message
--squash squash docker layers before push them to docker.io (requires docker-squash python module)
"
exit 0
Expand Down Expand Up @@ -80,8 +81,10 @@ if [[ ${*/--no-cache//} != "${*}" ]]; then
BUILD_ARGS+=(--no-cache)
fi

docker build "${BUILD_ARGS[@]}" --build-arg VERSION="$VERSION" -t "$ORG/$IMAGE:$VERSION" .
docker image prune --force
[[ ${*/--skip-build//} != "${*}" ]] || {
docker build "${BUILD_ARGS[@]}" --build-arg VERSION="$VERSION" -t "$ORG/$IMAGE:$VERSION" .
docker image prune --force
}

[[ ${*/--latest//} != "${*}" ]] && {
docker tag "$ORG"/"$IMAGE":"$VERSION" "$ORG"/"$IMAGE":latest
Expand Down

0 comments on commit 1507444

Please sign in to comment.