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 5
5
here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
6
6
7
7
# shellcheck disable=SC1091
8
- source " $here /rust-version .sh"
8
+ source " $here /docker/env .sh"
9
9
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}
2
3
3
4
ARG \
4
5
RUST_VERSION= \
Original file line number Diff line number Diff line change 5
5
here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
6
6
7
7
# shellcheck disable=SC1091
8
- source " $here /../rust-version .sh"
8
+ source " $here /env .sh"
9
9
10
10
platform=()
11
11
if [[ $( uname -m) = arm64 ]]; then
12
12
# Ref: https://blog.jaimyn.dev/how-to-build-multi-architecture-docker-images-on-an-m1-mac/#tldr
13
13
platform+=(--platform linux/amd64)
14
14
fi
15
15
16
- echo " build image: ${ci_docker_image :? } "
16
+ echo " build image: ${CI_DOCKER_IMAGE :? } "
17
17
docker build " ${platform[@]} " \
18
18
-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 " .
22
27
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"
37
37
38
38
export rust_nightly=nightly-" $nightly_version "
39
39
40
- export ci_docker_image=" anzaxyz/ci:rust_${rust_stable} _${rust_nightly} "
41
-
42
40
[[ -z $1 ]] || (
43
41
44
42
rustup_install () {
Original file line number Diff line number Diff line change @@ -192,9 +192,9 @@ build() {
192
192
supported=(" 20.04" )
193
193
declare MAYBE_DOCKER=
194
194
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 :? } "
198
198
fi
199
199
SECONDS=0
200
200
(
You can’t perform that action at this time.
0 commit comments