/ scripts / build.sh
build.sh
 1  #!/usr/bin/env bash
 2  
 3  set -e
 4  tmp_path=${BUILD_TMP_PATH:-/tmp/planar-build}
 5  # repo="https://github.com/psydyllic/Planar.jl"
 6  repo=${BUILD_REPO:-.}
 7  image=${1:-${BUILD_IMAGE:-planar}}
 8  if [ -n "$2" ]; then
 9      shift
10  fi
11  
12  if [ ! -e "$tmp_path" ]; then
13      git clone --depth=1 "$repo" "$tmp_path"
14      cd $tmp_path
15      git submodule update --init
16      direnv allow
17  fi
18  
19  cp $tmp_path/Dockerfile $repo/ || true
20  cd $tmp_path
21  
22  COMPILE_SCRIPT="$(sed "s/$/\\\\n/" "$repo/scripts/compile.jl")"
23  
24  ${BUILD_RUNTIME:-docker} buildx build "$@" --build-arg=COMPILE_SCRIPT="'$COMPILE_SCRIPT'" -t "$image" .