From 7a8bacfdbff9cb52eec584d34414199ab52a9e64 Mon Sep 17 00:00:00 2001 From: yihau Date: Wed, 11 Dec 2024 15:59:32 +0800 Subject: [PATCH 1/2] ci: unify solana docker base image --- sdk/docker-solana/Dockerfile | 3 ++- sdk/docker-solana/build.sh | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/docker-solana/Dockerfile b/sdk/docker-solana/Dockerfile index efd8c564edf79a..1d307b0c423e49 100644 --- a/sdk/docker-solana/Dockerfile +++ b/sdk/docker-solana/Dockerfile @@ -1,4 +1,5 @@ -FROM debian:bookworm +ARG BASE_IMAGE= +FROM ${BASE_IMAGE} # RPC JSON EXPOSE 8899/tcp diff --git a/sdk/docker-solana/build.sh b/sdk/docker-solana/build.sh index 70e3d0d23e44de..a10bbc8a3c613f 100755 --- a/sdk/docker-solana/build.sh +++ b/sdk/docker-solana/build.sh @@ -4,6 +4,7 @@ set -ex cd "$(dirname "$0")"/../.. eval "$(ci/channel-info.sh)" source ci/rust-version.sh +source ci/docker/env.sh CHANNEL_OR_TAG= if [[ -n "$CI_TAG" ]]; then @@ -29,7 +30,9 @@ cp -f ../../fetch-spl.sh usr/bin/ ./fetch-spl.sh ) -docker build -t anzaxyz/agave:"$CHANNEL_OR_TAG" . +docker build \ + --build-arg "BASE_IMAGE=${BASE_IMAGE}" \ + -t anzaxyz/agave:"$CHANNEL_OR_TAG" . maybeEcho= if [[ -z $CI ]]; then From f1c7ec05946e891fc9ead995f4e80a39ef6bb606 Mon Sep 17 00:00:00 2001 From: yihau Date: Wed, 11 Dec 2024 16:09:23 +0800 Subject: [PATCH 2/2] avoid env name collision --- ci/docker/build.sh | 14 +++++++------- ci/docker/env.sh | 32 ++++++++++++++++---------------- sdk/docker-solana/build.sh | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ci/docker/build.sh b/ci/docker/build.sh index c37a821673577c..de234b8846e960 100755 --- a/ci/docker/build.sh +++ b/ci/docker/build.sh @@ -16,13 +16,13 @@ fi echo "build image: ${CI_DOCKER_IMAGE:?}" docker build "${platform[@]}" \ -f "$here/Dockerfile" \ - --build-arg "BASE_IMAGE=${BASE_IMAGE}" \ - --build-arg "RUST_VERSION=${RUST_VERSION}" \ - --build-arg "RUST_NIGHTLY_VERSION=${RUST_NIGHTLY_VERSION}" \ - --build-arg "GOLANG_VERSION=${GOLANG_VERSION}" \ - --build-arg "NODE_MAJOR=${NODE_MAJOR}" \ - --build-arg "SCCACHE_VERSION=${SCCACHE_VERSION}" \ - --build-arg "GRCOV_VERSION=${GRCOV_VERSION}" \ + --build-arg "BASE_IMAGE=${CI_DOCKER_ARG_BASE_IMAGE}" \ + --build-arg "RUST_VERSION=${CI_DOCKER_ARG_RUST_VERSION}" \ + --build-arg "RUST_NIGHTLY_VERSION=${CI_DOCKER_ARG_RUST_NIGHTLY_VERSION}" \ + --build-arg "GOLANG_VERSION=${CI_DOCKER_ARG_GOLANG_VERSION}" \ + --build-arg "NODE_MAJOR=${CI_DOCKER_ARG_NODE_MAJOR}" \ + --build-arg "SCCACHE_VERSION=${CI_DOCKER_ARG_SCCACHE_VERSION}" \ + --build-arg "GRCOV_VERSION=${CI_DOCKER_ARG_GRCOV_VERSION}" \ -t "$CI_DOCKER_IMAGE" . docker push "$CI_DOCKER_IMAGE" diff --git a/ci/docker/env.sh b/ci/docker/env.sh index d59183278d9bb4..b45faef51f8630 100755 --- a/ci/docker/env.sh +++ b/ci/docker/env.sh @@ -10,25 +10,25 @@ if [[ -z "${rust_stable}" || -z "${rust_nightly}" ]]; then exit 1 fi -export BASE_IMAGE=ubuntu:22.04 -export RUST_VERSION="${rust_stable}" -export RUST_NIGHTLY_VERSION="${rust_nightly}" -export GOLANG_VERSION=1.21.3 -export NODE_MAJOR=18 -export SCCACHE_VERSION=v0.8.1 -export GRCOV_VERSION=v0.8.18 +export CI_DOCKER_ARG_BASE_IMAGE=ubuntu:22.04 +export CI_DOCKER_ARG_RUST_VERSION="${rust_stable}" +export CI_DOCKER_ARG_RUST_NIGHTLY_VERSION="${rust_nightly}" +export CI_DOCKER_ARG_GOLANG_VERSION=1.21.3 +export CI_DOCKER_ARG_NODE_MAJOR=18 +export CI_DOCKER_ARG_SCCACHE_VERSION=v0.8.1 +export CI_DOCKER_ARG_GRCOV_VERSION=v0.8.18 hash_vars=( - "${BASE_IMAGE}" - "${RUST_VERSION}" - "${RUST_NIGHTLY_VERSION}" - "${GOLANG_VERSION}" - "${NODE_MAJOR}" - "${SCCACHE_VERSION}" - "${GRCOV_VERSION}" + "${CI_DOCKER_ARG_BASE_IMAGE}" + "${CI_DOCKER_ARG_RUST_VERSION}" + "${CI_DOCKER_ARG_RUST_NIGHTLY_VERSION}" + "${CI_DOCKER_ARG_GOLANG_VERSION}" + "${CI_DOCKER_ARG_NODE_MAJOR}" + "${CI_DOCKER_ARG_SCCACHE_VERSION}" + "${CI_DOCKER_ARG_GRCOV_VERSION}" ) hash_input=$(IFS="_"; echo "${hash_vars[*]}") ci_docker_hash=$(echo -n "${hash_input}" | sha256sum | head -c 8) -SANITIZED_BASE_IMAGE="${BASE_IMAGE//:/-}" -export CI_DOCKER_IMAGE="anzaxyz/ci:${SANITIZED_BASE_IMAGE}_rust-${RUST_VERSION}_${RUST_NIGHTLY_VERSION}_${ci_docker_hash}" +CI_DOCKER_SANITIZED_BASE_IMAGE="${CI_DOCKER_ARG_BASE_IMAGE//:/-}" +export CI_DOCKER_IMAGE="anzaxyz/ci:${CI_DOCKER_SANITIZED_BASE_IMAGE}_rust-${CI_DOCKER_ARG_RUST_VERSION}_${CI_DOCKER_ARG_RUST_NIGHTLY_VERSION}_${ci_docker_hash}" diff --git a/sdk/docker-solana/build.sh b/sdk/docker-solana/build.sh index a10bbc8a3c613f..fc234e9a12beb0 100755 --- a/sdk/docker-solana/build.sh +++ b/sdk/docker-solana/build.sh @@ -31,7 +31,7 @@ cp -f ../../fetch-spl.sh usr/bin/ ) docker build \ - --build-arg "BASE_IMAGE=${BASE_IMAGE}" \ + --build-arg "BASE_IMAGE=${CI_DOCKER_ARG_BASE_IMAGE}" \ -t anzaxyz/agave:"$CHANNEL_OR_TAG" . maybeEcho=