#!/usr/bin/env bash

. $(dirname $0)/util
set -e

: ${PLATFORMS=}

platformFlag=""
if [ -n "$PLATFORMS" ]; then
  platformFlag="--platform=$PLATFORMS"
fi

if [ -n "$RUNC_PLATFORMS" ]; then
  buildxCmd build $cacheFromFlags $cacheToFlags \
    --target "binaries-linux-helper" \
    --platform "$RUNC_PLATFORMS" \
    $currentcontext
fi

buildxCmd build $platformFlag $cacheFromFlags \
  $currentcontext
