Skip to content

Commit

Permalink
adds dependencies for to-nonroot builds
Browse files Browse the repository at this point in the history
  • Loading branch information
solsson committed May 24, 2024
1 parent 49b55d1 commit 49f23f3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# generated by ./test.sh for manual copy-paste to images.yaml
### build steps below are generated ###
-
name: Build and push builder-base latest
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -238,6 +238,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/java:root=docker-image://ghcr.io/yolean/java:root
-
name: Build and push node root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -266,6 +268,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/node:root=docker-image://ghcr.io/yolean/node:root
-
name: Build and push node-kafka root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -296,6 +300,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/node-kafka:root=docker-image://ghcr.io/yolean/node-kafka:root
-
name: Build and push node-kafka-cache root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -326,6 +332,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/node-kafka-cache:root=docker-image://ghcr.io/yolean/node-kafka-cache:root
-
name: Build and push node-watchexec root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -354,6 +362,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/node-watchexec:root=docker-image://ghcr.io/yolean/node-watchexec:root
-
name: Build and push node-gcloud root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -384,6 +394,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/node-gcloud:root=docker-image://ghcr.io/yolean/node-gcloud:root
-
name: Build and push runtime-quarkus-ubuntu root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -412,6 +424,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/runtime-quarkus-ubuntu:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu:root
-
name: Build and push runtime-quarkus-ubuntu-jre root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -443,6 +457,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/runtime-quarkus-ubuntu-jre:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu-jre:root
-
name: Build and push runtime-quarkus-dev root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -474,6 +490,8 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/runtime-quarkus-dev:root=docker-image://ghcr.io/yolean/runtime-quarkus-dev:root
-
name: Build and push toil-storage root
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -505,3 +523,5 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
yolean/toil-storage:root=docker-image://ghcr.io/yolean/toil-storage:root
25 changes: 16 additions & 9 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ git-http-readonly
headless-chrome
"

ACTIONS="./actions-generated.yaml"
echo " # generated by $0 for manual copy-paste to images.yaml" > $ACTIONS
BEGIN=" ### build steps below are generated ###"
CURRENT=.github/workflows/images.yaml
ACTIONS=$(mktemp)
sed "/^$BEGIN\$/q" $CURRENT > $ACTIONS

function base_action {
CONTEXT=$1
NAME=$2
TAG=$3
TAGSUFFIX=""
[ "$TAG" = "latest" ] || TAGSUFFIX="-$TAG"
local CONTEXT=$1
local NAME=$2
local TAG=$3
local TAGSUFFIX=""
[ "$TAG" = "latest" ] || local TAGSUFFIX="-$TAG"
cat <<EOF
-
name: Build and push $NAME $TAG
Expand All @@ -78,8 +80,8 @@ EOF
}

function add_dependencies {
CONTEXT=$1
DEPENDENCIES="$((grep -e 'FROM --platform=$TARGETPLATFORM yolean/' $CONTEXT/Dockerfile || true) | cut -d' ' -f3)"
local CONTEXT=$1
local DEPENDENCIES="$((grep -e 'FROM --platform=$TARGETPLATFORM yolean/' $CONTEXT/Dockerfile || true) | cut -d' ' -f3)"
[ -z "$DEPENDENCIES" ] || echo " build-contexts: |"
for NAME in $DEPENDENCIES; do
echo " $NAME=docker-image://ghcr.io/$NAME"
Expand All @@ -98,8 +100,13 @@ for CONTEXT in $MULTIARCH_TONONROOT; do
base_action "$CONTEXT" "$CONTEXT" root >> $ACTIONS
add_dependencies "$CONTEXT" >> $ACTIONS
base_action "to-nonroot/$CONTEXT" "$CONTEXT" latest >> $ACTIONS
add_dependencies "to-nonroot/$CONTEXT" >> $ACTIONS
done
for CONTEXT in $AMD64ONLY; do
echo "# TODO does $CONTEXT really need to be amd64-only?" >&2
done
cp $ACTIONS $CURRENT
GIT_STATUS=$(git status --untracked-files=no --porcelain=v2)
[ -z "$GIT_STATUS" ] && echo "Done, no local diff" || echo "Done, with local diff"

0 comments on commit 49f23f3

Please sign in to comment.