aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Dockerfile4
-rw-r--r--dockerfile-common.sh34
-rw-r--r--push-docker.sh22
-rw-r--r--run-dockerfile.sh49
4 files changed, 72 insertions, 37 deletions
diff --git a/Dockerfile b/Dockerfile
index 215038ec8..a91619c84 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -125,7 +125,9 @@ FROM prebuild as build_release
WORKDIR /home/ubuntu/bun
-RUN release \
+ENV BUN_RELEASE_DIR /home/ubuntu/bun-release
+
+RUN mkdir -p $BUN_RELEASE_DIR; make release \
copy-to-bun-release-dir
diff --git a/dockerfile-common.sh b/dockerfile-common.sh
new file mode 100644
index 000000000..c9c1a4efa
--- /dev/null
+++ b/dockerfile-common.sh
@@ -0,0 +1,34 @@
+export DOCKER_BUILDKIT=1
+
+export BUILDKIT_ARCH=$(uname -m)
+export ARCH=${BUILDKIT_ARCH}
+
+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
diff --git a/push-docker.sh b/push-docker.sh
new file mode 100644
index 000000000..16d9640fd
--- /dev/null
+++ b/push-docker.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+source "dockerfile-common.sh"
+
+export CONTAINER_NAME=$CONTAINER_NAME
+
+docker build . --target build_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"
+ exit 1
+fi
+
+id=$(docker create $CONTAINER_NAME:latest)
+if (($?)); then
+ echo "Failed to cp container"
+ exit 1
+fi
+
+REGISTRY="ghcr.io/jarred-sumner"
+docker push $REGISTRY/$CONTAINER_NAME:latest
+# docker push $ECR/$CONTAINER_NAME:$BUILD_ID
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:"