diff options
Diffstat (limited to 'run-dockerfile.sh')
-rw-r--r-- | run-dockerfile.sh | 49 |
1 files changed, 13 insertions, 36 deletions
diff --git a/run-dockerfile.sh b/run-dockerfile.sh index 8817aff04..df22cd2b6 100644 --- a/run-dockerfile.sh +++ b/run-dockerfile.sh @@ -1,43 +1,13 @@ #!/bin/bash -export DOCKER_BUILDKIT=1 +source "dockerfile-common.sh" -export BUILDKIT_ARCH=$(uname -m) -export ARCH=${BUILDKIT_ARCH} +export $CONTAINER_NAME=$CONTAINER_NAME-local -if [ "$BUILDKIT_ARCH" == "amd64" ]; then - export BUILDKIT_ARCH="amd64" - export ARCH=x64 -fi - -if [ "$BUILDKIT_ARCH" == "x86_64" ]; then - export BUILDKIT_ARCH="amd64" - export ARCH=x64 -fi - -if [ "$BUILDKIT_ARCH" == "arm64" ]; then - export BUILDKIT_ARCH="arm64" - export ARCH=aarch64 -fi - -if [ "$BUILDKIT_ARCH" == "aarch64" ]; then - export BUILDKIT_ARCH="arm64" - export ARCH=aarch64 -fi - -if [ "$BUILDKIT_ARCH" == "armv7l" ]; then - echo "Unsupported platform: $BUILDKIT_ARCH" - exit 1 -fi - -export BUILD_ID=$(cat build-id) -export CONTAINER_NAME=bun-linux-$ARCH -export DEBUG_CONTAINER_NAME=debug-bun-linux-$ARCH -export TEMP=/tmp/bun-0.0.$BUILD_ID rm -rf $TEMP mkdir -p $TEMP -docker build . --target build_release --progress=plain -t $CONTAINER_NAME:latest --build-arg BUILDKIT_INLINE_CACHE=1 --platform=linux/aarch64 --cache-from $CONTAINER_NAME:latest +docker build . --target release --progress=plain -t $CONTAINER_NAME:latest --build-arg BUILDKIT_INLINE_CACHE=1 --platform=linux/$BUILDKIT_ARCH --cache-from $CONTAINER_NAME:latest if (($?)); then echo "Failed to build container" @@ -60,9 +30,16 @@ docker rm -v $id abs=$(realpath $TEMP/$CONTAINER_NAME.zip) debug_abs=$(realpath $TEMP/$DEBUG_CONTAINER_NAME.zip) -if command -v bun --version >/dev/null; then - cp $TEMP/$CONTAINER_NAME/bun $(which bun) - cp $TEMP/$DEBUG_CONTAINER_NAME/bun $(which bun-profile) +case $(uname -s) in +"Linux") target="linux" ;; +*) target="other" ;; +esac + +if [ "$target" = "linux" ]; then + if command -v bun --version >/dev/null; then + cp $TEMP/$CONTAINER_NAME/bun $(which bun) + cp $TEMP/$DEBUG_CONTAINER_NAME/bun $(which bun-profile) + fi fi echo "Saved to:" |