mirror of
				https://github.com/Icinga/docker-icinga2.git
				synced 2025-10-30 23:00:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			864 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			864 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| # Icinga 2 Docker image | (c) 2020 Icinga GmbH | GPLv2+
 | |
| set -exo pipefail
 | |
| 
 | |
| I2SRC="$1"
 | |
| ACTION="${2:-local}"
 | |
| TAG="${3:-test}"
 | |
| 
 | |
| if [ -z "$I2SRC" ]; then
 | |
| 	cat <<EOF >&2
 | |
| Usage: ${0} /icinga2/source/dir [local|all|push [TAG]]
 | |
| EOF
 | |
| 
 | |
| 	false
 | |
| fi
 | |
| 
 | |
| if ! docker version; then
 | |
| 	echo 'Docker not found' >&2
 | |
| 	false
 | |
| fi
 | |
| 
 | |
| if ! docker buildx version; then
 | |
| 	echo '"docker buildx" not found (see https://docs.docker.com/buildx/working-with-buildx/ )' >&2
 | |
| 	false
 | |
| fi
 | |
| 
 | |
| OUR_DIR="$(realpath "$(dirname "$0")")"
 | |
| COMMON_ARGS=(-t "icinga/icinga2:$TAG" --build-context "icinga2-git=$(realpath "$I2SRC")/.git/" "$OUR_DIR")
 | |
| BUILDX=(docker buildx build --platform "$(cat "${OUR_DIR}/platforms.txt")")
 | |
| 
 | |
| case "$ACTION" in
 | |
| 	all)
 | |
| 		"${BUILDX[@]}" "${COMMON_ARGS[@]}"
 | |
| 		;;
 | |
| 	push)
 | |
| 		"${BUILDX[@]}" --push "${COMMON_ARGS[@]}"
 | |
| 		;;
 | |
| 	*)
 | |
| 		docker buildx build --load "${COMMON_ARGS[@]}"
 | |
| 		;;
 | |
| esac
 |