feat: Corrected kotlin dev and added in build script to allow local running
This commit is contained in:
		
							
								
								
									
										58
									
								
								build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										58
									
								
								build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -euo pipefail
 | 
			
		||||
 | 
			
		||||
# Defaults
 | 
			
		||||
default_registry="git.luke-else.co.uk"
 | 
			
		||||
default_username="luke-else"
 | 
			
		||||
 | 
			
		||||
# Use env vars if set, otherwise fallback to defaults
 | 
			
		||||
registry="${CONTAINER_REGISTRY:-$default_registry}"
 | 
			
		||||
username="${CONTAINER_REGISTRY_USERNAME:-$default_username}"
 | 
			
		||||
 | 
			
		||||
# Parse args: only push when -p or --push is provided
 | 
			
		||||
push=false
 | 
			
		||||
usage() { echo "Usage: $0 [--push|-p]"; }
 | 
			
		||||
 | 
			
		||||
while [ "$#" -gt 0 ]; do
 | 
			
		||||
  case "$1" in
 | 
			
		||||
    -p|--push) push=true; shift ;;
 | 
			
		||||
    -h|--help) usage; exit 0 ;;
 | 
			
		||||
    *) echo "Unknown option: $1"; usage; exit 1 ;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
echo "Registry: $registry"
 | 
			
		||||
echo "Username: $username"
 | 
			
		||||
echo "Push enabled: $push"
 | 
			
		||||
 | 
			
		||||
# Build 'base' and 'lab' groups first (including subdirectories)
 | 
			
		||||
for group in base lab; do
 | 
			
		||||
  if [ -d "$group" ]; then
 | 
			
		||||
    echo "Processing group: $group"
 | 
			
		||||
    find "$group" -type f -iname 'Dockerfile' -exec dirname {} \; | sed 's|^\./||' | sort -u | while read -r dir; do
 | 
			
		||||
      tag="$registry/$username/$dir:latest"
 | 
			
		||||
      echo "Building $dir -> $tag"
 | 
			
		||||
      docker build -t "$tag" "$dir"
 | 
			
		||||
      if [ "$push" = true ]; then
 | 
			
		||||
        docker push "$tag"
 | 
			
		||||
      else
 | 
			
		||||
        echo "Push skipped for $tag"
 | 
			
		||||
      fi
 | 
			
		||||
    done
 | 
			
		||||
  else
 | 
			
		||||
    echo "Skipping missing group: $group"
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Then build everything else (exclude base and lab)
 | 
			
		||||
echo "Processing remaining Dockerfiles"
 | 
			
		||||
find . -type f -iname 'Dockerfile' -exec dirname {} \; | sed 's|^\./||' | sort -u | grep -Ev '^(base|lab)(/|$)' | while read -r dir; do
 | 
			
		||||
  tag="$registry/$username/$dir:latest"
 | 
			
		||||
  echo "Building $dir -> $tag"
 | 
			
		||||
  docker build -t "$tag" "$dir"
 | 
			
		||||
  if [ "$push" = true ]; then
 | 
			
		||||
    docker push "$tag"
 | 
			
		||||
  else
 | 
			
		||||
    echo "Push skipped for $tag"
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
		Reference in New Issue
	
	Block a user