From 860c310e6a0253192691d425ea67c92d1006b474 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 30 Jan 2024 14:29:22 -0500 Subject: [PATCH] Publish docker images with race detection --- .github/workflows/publish_image.sh | 2 +- Dockerfile | 3 ++- scripts/build_image.sh | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_image.sh b/.github/workflows/publish_image.sh index 0aef0feb5ce..d6988bdeb99 100755 --- a/.github/workflows/publish_image.sh +++ b/.github/workflows/publish_image.sh @@ -14,7 +14,7 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd ) source "$AVALANCHE_PATH"/scripts/constants.sh # Build current avalanchego -source "$AVALANCHE_PATH"/scripts/build_image.sh -r +source "$AVALANCHE_PATH"/scripts/build_image.sh if [[ $current_branch == "master" ]]; then echo "Tagging current avalanchego image as $avalanchego_dockerhub_repo:latest" diff --git a/Dockerfile b/Dockerfile index 21ab344ef4b..a13fbddbd4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,8 @@ RUN go mod download COPY . . # Build avalanchego -RUN ./scripts/build.sh +ARG RACE_FLAG="" +RUN ./scripts/build.sh ${RACE_FLAG} # ============= Cleanup Stage ================ FROM debian:11-slim AS execution diff --git a/scripts/build_image.sh b/scripts/build_image.sh index 0a82c5342b1..e6b00732cab 100755 --- a/scripts/build_image.sh +++ b/scripts/build_image.sh @@ -15,3 +15,7 @@ commit_hash="${full_commit_hash::8}" echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash , $avalanchego_dockerhub_repo:$current_branch" docker build -t "$avalanchego_dockerhub_repo:$commit_hash" \ -t "$avalanchego_dockerhub_repo:$current_branch" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile" + +echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash-race , $avalanchego_dockerhub_repo:$current_branch-race" +docker build --build-arg="RACE_FLAG=-r" -t "$avalanchego_dockerhub_repo:$commit_hash-race" \ + -t "$avalanchego_dockerhub_repo:$current_branch-race" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile"