feat: Corrected kotlin dev and added in build script to allow local running
This commit is contained in:
@@ -24,35 +24,12 @@ jobs:
|
||||
|
||||
- name: Build and push containers
|
||||
run: |
|
||||
# ...existing code...
|
||||
set -euo pipefail
|
||||
|
||||
registry="${{ secrets.CONTAINER_REGISTRY }}"
|
||||
username="${{ secrets.CONTAINER_REGISTRY_USERNAME }}"
|
||||
|
||||
# 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"
|
||||
docker push "$tag"
|
||||
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"
|
||||
docker push "$tag"
|
||||
done
|
||||
- name: Build and push containers
|
||||
env:
|
||||
CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }}
|
||||
CONTAINER_REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
|
||||
run: |
|
||||
./build.sh -p
|
||||
|
||||
- name: Docker Prune
|
||||
run: docker system prune -f --all
|
||||
|
||||
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
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM git.luke-else.co.uk/luke-else/lab:latest
|
||||
|
||||
RUN apk add --no-cache unzip zip openjdk21
|
||||
RUN sudo apk add --no-cache unzip zip openjdk21
|
||||
|
||||
# Set Java environment variables
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk
|
||||
@@ -14,4 +14,4 @@ RUN curl -s "https://get.sdkman.io" | bash && \
|
||||
|
||||
# Make SDKMAN tools available in PATH
|
||||
ENV SDKMAN_DIR="/root/.sdkman"
|
||||
ENV PATH="$SDKMAN_DIR/candidates/kotlin/current/bin:$SDKMAN_DIR/candidates/gradle/current/bin:$PATH"
|
||||
ENV PATH="$SDKMAN_DIR/candidates/kotlin/current/bin:$SDKMAN_DIR/candidates/gradle/current/bin:$PATH"
|
||||
|
||||
Reference in New Issue
Block a user