From 1436c2d2f04da0e07cf07a9c7e4bfb3c158f6380 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 6 Dec 2024 12:44:27 +0100 Subject: [PATCH 01/10] fix: prysm minimal go build --- prysm/build_beacon_minimal.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 0faa136..a16bb54 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -6,7 +6,7 @@ OS_NAME=$(uname -s | tr '[:upper:]' '[:lower:]') if [ "${OS_NAME}" == "darwin" ]; then /opt/homebrew/bin/brew install go /opt/homebrew/bin/go install github.com/bazelbuild/bazelisk@latest -else +else sudo apt-get update sudo apt-get upgrade -y sudo apt install -y ca-certificates python3 @@ -19,7 +19,7 @@ case ${build_method} in "go") echo "Building with Go..." go mod tidy - + # Define ldflags for version information ldflags=$(cat <<-END -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.gitCommit=$(git rev-parse HEAD)' \ @@ -28,11 +28,11 @@ case ${build_method} in -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDateUnix=$(date +%s)' END ) - + # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags=blst_enabled,blst_portable \ + -tags=blst_enabled,blst_portable,minimal \ -ldflags "${ldflags}" \ -o _beacon-chain ./cmd/beacon-chain ;; From bf7baa8c130f2b8aefd31e39937b32ffefc5f35d Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 6 Dec 2024 12:53:17 +0100 Subject: [PATCH 02/10] fix: prysm minimal go build --- prysm/build_beacon_minimal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index a16bb54..5fc2c4c 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -32,7 +32,7 @@ END # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags=blst_enabled,blst_portable,minimal \ + -tags=blst_enabled,blst_portable,preset_minimal \ -ldflags "${ldflags}" \ -o _beacon-chain ./cmd/beacon-chain ;; From 7882d51c27ff2acf096bd379bcd539bfd33085c6 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 6 Dec 2024 13:14:25 +0100 Subject: [PATCH 03/10] try ldflags --- prysm/build_beacon_minimal.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 5fc2c4c..31a7e76 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -25,14 +25,15 @@ case ${build_method} in -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.gitCommit=$(git rev-parse HEAD)' \ -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.gitTag=$(git describe --tags 2>/dev/null || echo Unknown)' \ -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDate=$(date -u +%Y-%m-%d\ %H:%M:%S%:z)' \ - -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDateUnix=$(date +%s)' + -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDateUnix=$(date +%s)' \ + -X '//proto:network=minimal' END ) # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags=blst_enabled,blst_portable,preset_minimal \ + -tags=blst_enabled,blst_portable \ -ldflags "${ldflags}" \ -o _beacon-chain ./cmd/beacon-chain ;; From dc73f4744d5bd33929d367ba24b0ada94c7479c5 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Sat, 7 Dec 2024 05:31:35 +1000 Subject: [PATCH 04/10] feat: Add support for minimal configuration in Docker builds --- prysm/build_beacon_minimal.sh | 8 ++++++-- prysm/build_validator_minimal.sh | 8 ++++++-- prysm/entrypoint.sh | 6 +++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 31a7e76..640ff26 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -33,7 +33,7 @@ END # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags=blst_enabled,blst_portable \ + -tags="--config=minimal,blst_enabled,blst_portable" \ -ldflags "${ldflags}" \ -o _beacon-chain ./cmd/beacon-chain ;; @@ -50,6 +50,10 @@ esac cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh -docker build -t "${target_repository}:${target_tag}" -t "${target_repository}:${target_tag}-${source_git_commit_hash}" --build-arg ENTRY=/app/cmd/beacon-chain/beacon-chain -f "../${target_dockerfile}" . +docker build -t "${target_repository}:${target_tag}" \ + -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ + --build-arg ENTRY=/app/cmd/beacon-chain/beacon-chain \ + --build-arg MINIMAL_CONFIG=true \ + -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/build_validator_minimal.sh b/prysm/build_validator_minimal.sh index 5d83fc4..ac09fe3 100755 --- a/prysm/build_validator_minimal.sh +++ b/prysm/build_validator_minimal.sh @@ -32,7 +32,7 @@ END # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags=blst_enabled,blst_portable \ + -tags="--config=minimal,blst_enabled,blst_portable" \ -ldflags "${ldflags}" \ -o _validator ./cmd/validator ;; @@ -49,6 +49,10 @@ esac cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh -docker build -t "${target_repository}:${target_tag}" -t "${target_repository}:${target_tag}-${source_git_commit_hash}" --build-arg ENTRY=/app/cmd/validator/validator -f "../${target_dockerfile}" . +docker build -t "${target_repository}:${target_tag}" \ + -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ + --build-arg ENTRY=/app/cmd/validator/validator \ + --build-arg MINIMAL_CONFIG=true \ + -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/entrypoint.sh b/prysm/entrypoint.sh index 21a01af..4ef8329 100755 --- a/prysm/entrypoint.sh +++ b/prysm/entrypoint.sh @@ -1,2 +1,6 @@ #!/bin/sh -exec "${ENTRY}" "$@" +if [ -n "${MINIMAL_CONFIG}" ]; then + exec "${ENTRY}" --minimal-config "$@" +else + exec "${ENTRY}" "$@" +fi From 3d0ad04c10ba0aed8d27976dbef11c12974f9b23 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Sat, 7 Dec 2024 05:38:28 +1000 Subject: [PATCH 05/10] style: Remove unnecessary line for "//proto:network=minimal" --- prysm/build_beacon_minimal.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 640ff26..6224fa1 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -25,8 +25,7 @@ case ${build_method} in -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.gitCommit=$(git rev-parse HEAD)' \ -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.gitTag=$(git describe --tags 2>/dev/null || echo Unknown)' \ -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDate=$(date -u +%Y-%m-%d\ %H:%M:%S%:z)' \ - -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDateUnix=$(date +%s)' \ - -X '//proto:network=minimal' + -X 'github.com/prysmaticlabs/prysm/v5/runtime/version.buildDateUnix=$(date +%s)' END ) From 6dc8378bab8e3a5f78664dcb00e18126ef4fc33a Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Sat, 7 Dec 2024 05:49:15 +1000 Subject: [PATCH 06/10] refactor: Update Docker build arguments in scripts --- prysm/build_beacon_minimal.sh | 3 +-- prysm/build_validator_minimal.sh | 3 +-- prysm/entrypoint.sh | 6 +----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 6224fa1..48cfb2c 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -51,8 +51,7 @@ cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh docker build -t "${target_repository}:${target_tag}" \ -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ - --build-arg ENTRY=/app/cmd/beacon-chain/beacon-chain \ - --build-arg MINIMAL_CONFIG=true \ + --build-arg ENTRY="/app/cmd/beacon-chain/beacon-chain --minimal-config" \ -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/build_validator_minimal.sh b/prysm/build_validator_minimal.sh index ac09fe3..80c2694 100755 --- a/prysm/build_validator_minimal.sh +++ b/prysm/build_validator_minimal.sh @@ -51,8 +51,7 @@ cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh docker build -t "${target_repository}:${target_tag}" \ -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ - --build-arg ENTRY=/app/cmd/validator/validator \ - --build-arg MINIMAL_CONFIG=true \ + --build-arg ENTRY="/app/cmd/validator/validator --minimal-config" \ -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/entrypoint.sh b/prysm/entrypoint.sh index 4ef8329..e9ec274 100755 --- a/prysm/entrypoint.sh +++ b/prysm/entrypoint.sh @@ -1,6 +1,2 @@ #!/bin/sh -if [ -n "${MINIMAL_CONFIG}" ]; then - exec "${ENTRY}" --minimal-config "$@" -else - exec "${ENTRY}" "$@" -fi +exec "${ENTRY}" "$@" \ No newline at end of file From 659948c016897586967d0d9614d6242744941e5f Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Sat, 7 Dec 2024 05:57:53 +1000 Subject: [PATCH 07/10] fix: Update build scripts to remove --minimal-config option --- prysm/build_beacon_minimal.sh | 4 ++-- prysm/build_validator_minimal.sh | 4 ++-- prysm/entrypoint_minimal.sh | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 prysm/entrypoint_minimal.sh diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 48cfb2c..00ce6e4 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -47,11 +47,11 @@ END ;; esac -cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh +cp ${SCRIPT_DIR}/entrypoint_minimal.sh entrypoint.sh docker build -t "${target_repository}:${target_tag}" \ -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ - --build-arg ENTRY="/app/cmd/beacon-chain/beacon-chain --minimal-config" \ + --build-arg ENTRY="/app/cmd/beacon-chain/beacon-chain" \ -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/build_validator_minimal.sh b/prysm/build_validator_minimal.sh index 80c2694..058b31a 100755 --- a/prysm/build_validator_minimal.sh +++ b/prysm/build_validator_minimal.sh @@ -47,11 +47,11 @@ END ;; esac -cp ${SCRIPT_DIR}/entrypoint.sh entrypoint.sh +cp ${SCRIPT_DIR}/entrypoint_minimal.sh entrypoint.sh docker build -t "${target_repository}:${target_tag}" \ -t "${target_repository}:${target_tag}-${source_git_commit_hash}" \ - --build-arg ENTRY="/app/cmd/validator/validator --minimal-config" \ + --build-arg ENTRY="/app/cmd/validator/validator" \ -f "../${target_dockerfile}" . docker push "${target_repository}:${target_tag}" docker push "${target_repository}:${target_tag}-${source_git_commit_hash}" diff --git a/prysm/entrypoint_minimal.sh b/prysm/entrypoint_minimal.sh new file mode 100644 index 0000000..728e319 --- /dev/null +++ b/prysm/entrypoint_minimal.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec "${ENTRY}" --minimal-config "$@" \ No newline at end of file From dcb8a04dce2c2303e3d3b7fe7e5287c32ea59783 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Sat, 7 Dec 2024 06:03:45 +1000 Subject: [PATCH 08/10] style: update file permissions --- prysm/entrypoint_minimal.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 prysm/entrypoint_minimal.sh diff --git a/prysm/entrypoint_minimal.sh b/prysm/entrypoint_minimal.sh old mode 100644 new mode 100755 From 3eb304dd433a8445eb9a8e09eabde02523abd4e2 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Mon, 9 Dec 2024 16:58:55 +0100 Subject: [PATCH 09/10] Update build_beacon_minimal.sh Signed-off-by: Barnabas Busa --- prysm/build_beacon_minimal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prysm/build_beacon_minimal.sh b/prysm/build_beacon_minimal.sh index 00ce6e4..6a9b54d 100755 --- a/prysm/build_beacon_minimal.sh +++ b/prysm/build_beacon_minimal.sh @@ -32,7 +32,7 @@ END # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags="--config=minimal,blst_enabled,blst_portable" \ + -tags="minimal,blst_enabled,blst_portable" \ -ldflags "${ldflags}" \ -o _beacon-chain ./cmd/beacon-chain ;; From fa5a518d1e0f480ef0aac6d1a3a4fb69c680a4cf Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Mon, 9 Dec 2024 16:59:11 +0100 Subject: [PATCH 10/10] Update build_validator_minimal.sh Signed-off-by: Barnabas Busa --- prysm/build_validator_minimal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prysm/build_validator_minimal.sh b/prysm/build_validator_minimal.sh index 058b31a..b35da1d 100755 --- a/prysm/build_validator_minimal.sh +++ b/prysm/build_validator_minimal.sh @@ -32,7 +32,7 @@ END # Build with blst_enabled and blst_portable to support both amd64 and arm64. The BLST library (used for # cryptographic operations) needs specific CPU features. CGO_ENABLED=1 go build \ - -tags="--config=minimal,blst_enabled,blst_portable" \ + -tags="minimal,blst_enabled,blst_portable" \ -ldflags "${ldflags}" \ -o _validator ./cmd/validator ;;