Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: unify solana docker base image #4052

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ci/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
32 changes: 16 additions & 16 deletions ci/docker/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
3 changes: 2 additions & 1 deletion sdk/docker-solana/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM debian:bookworm
ARG BASE_IMAGE=
FROM ${BASE_IMAGE}

# RPC JSON
EXPOSE 8899/tcp
Expand Down
5 changes: 4 additions & 1 deletion sdk/docker-solana/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=${CI_DOCKER_ARG_BASE_IMAGE}" \
-t anzaxyz/agave:"$CHANNEL_OR_TAG" .

maybeEcho=
if [[ -z $CI ]]; then
Expand Down