diff --git a/ci-build-docker-image.sh b/ci-build-docker-image.sh new file mode 100755 index 0000000..1a62840 --- /dev/null +++ b/ci-build-docker-image.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# CI/CD script to build and push Docker images for workspace projects +# Uses version from package.json and automatically pushes to registry + +set -e # Exit on error + +# List of workspaces to build +WORKSPACES=( + "mailgun-webhook" +) + +printf "\n=== CI/CD Docker Image Build ===\n" +printf "Building %d workspace(s)\n\n" "${#WORKSPACES[@]}" + +for WORKSPACE_DIR in "${WORKSPACES[@]}"; do + printf "\n--- Building workspace: %s ---\n\n" "$WORKSPACE_DIR" + + if [ ! -d "$WORKSPACE_DIR" ]; then + printf "\nERROR: Directory '%s' does not exist. Skipping.\n\n" "$WORKSPACE_DIR" + continue + fi + + if [ ! -f "$WORKSPACE_DIR/build-image.sh" ]; then + printf "\nERROR: build-image.sh not found in '%s'. Skipping.\n\n" "$WORKSPACE_DIR" + continue + fi + + cd "$WORKSPACE_DIR" + ./build-image.sh --auto-version --auto-push + cd .. + + printf "\n--- Completed: %s ---\n" "$WORKSPACE_DIR" +done + +printf "\n=== All builds completed successfully! ===\n\n"