#!/bin/sh set -eu if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then echo 'Usage: /root/buildkit/bin/build-image IMAGE_TAG [OUTPUT_TAR]' >&2 exit 2 fi tag=$1 out=${2:-./image.tar} case "$tag$out" in *','*) echo 'Commas are not supported in tag/output path' >&2; exit 2;; esac test -f Dockerfile || { echo 'Run from the project directory containing Dockerfile' >&2; exit 2; } exec /root/buildkit/bin/buildctl \ --addr unix:///root/buildkit/socket/buildkitd.sock build \ --frontend dockerfile.v0 --local context=. --local dockerfile=. \ --output "type=docker,name=$tag,dest=$out"