File tree Expand file tree Collapse file tree 6 files changed +52
-14
lines changed Expand file tree Collapse file tree 6 files changed +52
-14
lines changed Original file line number Diff line number Diff line change 55here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
66
77# shellcheck disable=SC1091
8- source " $here /rust-version .sh"
8+ source " $here /docker/env .sh"
99
10- " $here /docker-run.sh" " ${ci_docker_image :? } " " $@ "
10+ " $here /docker-run.sh" " ${CI_DOCKER_IMAGE :? } " " $@ "
Original file line number Diff line number Diff line change 1- FROM ubuntu:20.04
1+ ARG BASE_IMAGE=
2+ FROM ${BASE_IMAGE}
23
34ARG \
45 RUST_VERSION= \
Original file line number Diff line number Diff line change 55here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
66
77# shellcheck disable=SC1091
8- source " $here /../rust-version .sh"
8+ source " $here /env .sh"
99
1010platform=()
1111if [[ $( uname -m) = arm64 ]]; then
1212 # Ref: https://blog.jaimyn.dev/how-to-build-multi-architecture-docker-images-on-an-m1-mac/#tldr
1313 platform+=(--platform linux/amd64)
1414fi
1515
16- echo " build image: ${ci_docker_image :? } "
16+ echo " build image: ${CI_DOCKER_IMAGE :? } "
1717docker build " ${platform[@]} " \
1818 -f " $here /Dockerfile" \
19- --build-arg " RUST_VERSION=${rust_stable:? } " \
20- --build-arg " RUST_NIGHTLY_VERSION=${rust_nightly:? } " \
21- -t " $ci_docker_image " .
19+ --build-arg " BASE_IMAGE=${BASE_IMAGE} " \
20+ --build-arg " RUST_VERSION=${RUST_VERSION} " \
21+ --build-arg " RUST_NIGHTLY_VERSION=${RUST_NIGHTLY_VERSION} " \
22+ --build-arg " GOLANG_VERSION=${GOLANG_VERSION} " \
23+ --build-arg " NODE_MAJOR=${NODE_MAJOR} " \
24+ --build-arg " SCCACHE_VERSION=${SCCACHE_VERSION} " \
25+ --build-arg " GRCOV_VERSION=${GRCOV_VERSION} " \
26+ -t " $CI_DOCKER_IMAGE " .
2227
23- docker push " $ci_docker_image "
28+ docker push " $CI_DOCKER_IMAGE "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ ci_docker_env_sh_here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
4+
5+ # shellcheck disable=SC1091
6+ source " ${ci_docker_env_sh_here} /../rust-version.sh"
7+
8+ if [[ -z " ${rust_stable} " || -z " ${rust_nightly} " ]]; then
9+ echo " Error: rust_stable or rust_nightly is empty. Please check rust-version.sh." >&2
10+ exit 1
11+ fi
12+
13+ export BASE_IMAGE=ubuntu:22.04
14+ export RUST_VERSION=" ${rust_stable} "
15+ export RUST_NIGHTLY_VERSION=" ${rust_nightly} "
16+ export GOLANG_VERSION=1.21.3
17+ export NODE_MAJOR=18
18+ export SCCACHE_VERSION=v0.8.1
19+ export GRCOV_VERSION=v0.8.18
20+
21+ hash_vars=(
22+ " ${BASE_IMAGE} "
23+ " ${RUST_VERSION} "
24+ " ${RUST_NIGHTLY_VERSION} "
25+ " ${GOLANG_VERSION} "
26+ " ${NODE_MAJOR} "
27+ " ${SCCACHE_VERSION} "
28+ " ${GRCOV_VERSION} "
29+ )
30+ hash_input=$( IFS=" _" ; echo " ${hash_vars[*]} " )
31+ ci_docker_hash=$( echo -n " ${hash_input} " | sha256sum | head -c 8)
32+
33+ SANITIZED_BASE_IMAGE=" ${BASE_IMAGE//:/ -} "
34+ export CI_DOCKER_IMAGE=" anzaxyz/ci:${SANITIZED_BASE_IMAGE} _rust-${RUST_VERSION} _${RUST_NIGHTLY_VERSION} _${ci_docker_hash} "
Original file line number Diff line number Diff line change @@ -37,8 +37,6 @@ export rust_stable="$stable_version"
3737
3838export rust_nightly=nightly-" $nightly_version "
3939
40- export ci_docker_image=" anzaxyz/ci:rust_${rust_stable} _${rust_nightly} "
41-
4240[[ -z $1 ]] || (
4341
4442 rustup_install () {
Original file line number Diff line number Diff line change @@ -192,9 +192,9 @@ build() {
192192 supported=(" 20.04" )
193193 declare MAYBE_DOCKER=
194194 if [[ $( uname) != Linux || ! " ${supported[*]} " =~ $( lsb_release -sr) ]]; then
195- # shellcheck source=ci/rust-version .sh
196- source " $SOLANA_ROOT " /ci/rust-version .sh
197- MAYBE_DOCKER=" ci/docker-run.sh ${ci_docker_image :? } "
195+ # shellcheck source=ci/docker/env .sh
196+ source " $SOLANA_ROOT " /ci/docker/env .sh
197+ MAYBE_DOCKER=" ci/docker-run.sh ${CI_DOCKER_IMAGE :? } "
198198 fi
199199 SECONDS=0
200200 (
You can’t perform that action at this time.
0 commit comments