chore(deploy): publish by default and pin production images
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build all four images before optional publication. Authentication stays in Docker.
|
||||
# Build all four images before publication. Authentication stays in Docker.
|
||||
# Disable tracing even when invoked with bash -x: command output may contain secrets.
|
||||
set +x
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'HELP'
|
||||
Usage: publish-images.sh [--tag TAG] [--dry-run] [--push]
|
||||
Usage: publish-images.sh [--tag TAG] [--dry-run]
|
||||
--tag TAG Image tag (default: full Git HEAD SHA)
|
||||
--dry-run Print the plan without executing Docker
|
||||
--push Publish after all four builds succeed
|
||||
Builds and pushes all four images by default.
|
||||
--push Accepted for compatibility; publication is already the default.
|
||||
-h, --help Show this help
|
||||
HELP
|
||||
}
|
||||
@ -18,7 +19,6 @@ fail() { printf '%s\n' "$1" >&2; exit 1; }
|
||||
tag=''
|
||||
tag_set=false
|
||||
dry_run=false
|
||||
push=false
|
||||
while (($#)); do
|
||||
case "$1" in
|
||||
--tag)
|
||||
@ -28,7 +28,7 @@ while (($#)); do
|
||||
shift 2
|
||||
;;
|
||||
--dry-run) dry_run=true; shift ;;
|
||||
--push) push=true; shift ;;
|
||||
--push) shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) fail 'Unknown argument; use --help' ;;
|
||||
esac
|
||||
@ -81,9 +81,7 @@ for name in backend frontend scraper laya; do
|
||||
"${extra[@]}" "$context"
|
||||
if ! "$dry_run"; then printf 'build completed: %s\n' "$image"; fi
|
||||
done
|
||||
if "$push"; then
|
||||
for image in "${images[@]}"; do
|
||||
run docker push "$image"
|
||||
if ! "$dry_run"; then printf 'push completed: %s\n' "$image"; fi
|
||||
done
|
||||
fi
|
||||
for image in "${images[@]}"; do
|
||||
run docker push "$image"
|
||||
if ! "$dry_run"; then printf 'push completed: %s\n' "$image"; fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user