Build binaries from local code

This commit is contained in:
Bojan Serafimov
2022-08-29 14:46:06 -04:00
parent 1324dd89ed
commit bc724bdb63
2 changed files with 37 additions and 0 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
/tmp_check
/tmp_install
/tmp_check_cli
/neon_install
__pycache__/
test_output/
.vscode

36
scripts/get_local_binaries.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# This script builds deployable binaries from local code.
set -e
mkdir -p neon_install/bin
# Building the image from scratch can take minutes, since we're recompiling everything,
# including dependencies. To save time we remember the container id so it can be reused
# for incremental compilation.
CONTAINER_ID_PATH="neon_install/container_id"
# Get the CONTAINER_ID, or create a container if one doesn't exist.
if [ -e $CONTAINER_ID_PATH ]
then
CONTAINER_ID=$(cat $CONTAINER_ID_PATH)
echo "Using existing container with id: $CONTAINER_ID"
else
echo "No existing container found. Creating ..."
docker build \
--tag "neon:local" \
--build-arg "REPOSITORY=neondatabase" \
# Don't use cachepot, it will only slow things down. Instead
# maybe reuse the same container to get incremental compilation.
--build-arg "RUSTC_WRAPPER=''" \
.
CONTAINER_ID=$(docker create neon:local)
fi
# TODO if files changed locally, cp the code into the image and incrementally re-compile.
# Or maybe mount code as a volume?
# Copy files out of the container
# TODO reuse the second part of .github/ansible/get_binaries.sh to get all the binaries
set -x
docker cp ${CONTAINER_ID}:/usr/local/bin/pageserver neon_install/bin/