Skip to content

Commit

Permalink
Update builder.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga authored Nov 21, 2024
1 parent 232ac73 commit 8e1456d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions scripts/builder.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

export BUILDKITD_FLAGS=--oci-worker-no-process-sandbox
if [ -z "$BUILDER_BINARY" ]; then
BUILDER_BINARY="${HOME}/builder"
fi

if [ -z "$EXPORT_REGISTRY" ]; then
EXPORT_REGISTRY="registry:5000/metacall/builder_cache"
Expand All @@ -10,17 +12,20 @@ if [ -z "$IMPORT_REGISTRY" ]; then
IMPORT_REGISTRY="registry:5000/metacall/builder_cache"
fi

if [ -z "$BUILDER_BINARY" ]; then
BUILDER_BINARY="${HOME}/builder"
fi

if [ -z "$1" ]; then
IMAGE_NAME="builder_output"
else
IMAGE_NAME="builder_output_$1"
fi

${BUILDER_BINARY} $@ | buildctl-daemonless.sh build \
if [ "$(id -u)" -eq 0 ]; then
BUILDKIT_COMMAND="buildctl --addr=\"docker-container://metacall_builder_buildkit\" build"
else
export BUILDKITD_FLAGS=--oci-worker-no-process-sandbox
BUILDKIT_COMMAND="buildctl-daemonless.sh build"
fi

${BUILDER_BINARY} $@ | ${BUILDKIT_COMMAND} \
--export-cache type=registry,ref=${EXPORT_REGISTRY},registry.insecure=true \
--import-cache type=registry,ref=${IMPORT_REGISTRY},registry.insecure=true \
--output type=image,name=registry:5000/metacall/${IMAGE_NAME},push=true,registry.insecure=true

0 comments on commit 8e1456d

Please sign in to comment.