update documentation
This commit is contained in:
36
build.sh
36
build.sh
@@ -1,31 +1,39 @@
|
||||
#set -euo pipefail
|
||||
set -u
|
||||
#!/bin/bash
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# build.sh – Build and push Docker images for Strichliste
|
||||
# build.sh – Build and push Docker images
|
||||
#
|
||||
# Usage:
|
||||
# ./build.sh [OPTIONS]
|
||||
#
|
||||
# Options:
|
||||
# -v, --version VERSION Image tag / version (default: git short SHA)
|
||||
# -r, --registry REGISTRY Registry prefix (default: "")
|
||||
# -s, --snapshot Version from git ref for prototyping
|
||||
# -r, --release Version from .env for releases
|
||||
# -v, --version VERSION Custom version
|
||||
# -p, --push Push images after build
|
||||
# --backend-only Only build backend
|
||||
# --frontend-only Only build frontend
|
||||
# -b, --backend-only Only build backend
|
||||
# -f, --frontend-only Only build frontend
|
||||
# -h, --help Show this help
|
||||
#
|
||||
# Examples:
|
||||
# ./build.sh -v 1.2.3 -r ghcr.io/aquantico --push
|
||||
# ./build.sh --version latest --registry registry.example.com --push
|
||||
# ./build.sh -v dev # build only, no push
|
||||
# ./build.sh -r -p
|
||||
# ./build.sh -s -frontend-only
|
||||
# ./build.sh -v dev
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source ".env"
|
||||
# -e: Exit immediately if any command returns a non-zero exit code
|
||||
# -u: Treat unset variables as errors
|
||||
# -o pipefail: Make pipelines fail if any command in the pipe fails, not just the last one
|
||||
set -euo pipefail
|
||||
|
||||
#cd to script dir
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
source "${SCRIPT_DIR}/.env"
|
||||
popd
|
||||
|
||||
#default: snapshot
|
||||
VERSION=$(git rev-parse --short HEAD 2>/dev/null || echo "local")
|
||||
VERSION="${IMAGE_TAG}-SNAPSHOT$(git rev-parse --short HEAD 2>/dev/null || echo "local")"
|
||||
|
||||
PUSH=false
|
||||
BUILD_BACKEND=true
|
||||
@@ -39,7 +47,7 @@ usage() {
|
||||
# --- parse arguments -------------------------------------------------------
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-s|--snapshot) VERSION=$(git rev-parse --short HEAD 2>/dev/null || echo "local"); shift ;;
|
||||
-s|--snapshot) VERSION="${IMAGE_TAG}-SNAPSHOT$(git rev-parse --short HEAD 2>/dev/null || echo "local")"; shift ;;
|
||||
-r|--release) VERSION=${IMAGE_TAG}; shift ;;
|
||||
-v|--version) VERSION=$2; shift 2 ;;
|
||||
-p|--push) PUSH=true; shift ;;
|
||||
|
||||
Reference in New Issue
Block a user