From 4d55e6f7fdb70a1ef470d6cd704f01afe504649d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 21 Sep 2022 11:58:05 -0400 Subject: [PATCH] Ensure Dockerfile stages use consistent Go version (backport #9462) (#9472) * Ensure Dockerfile stages use consistent Go version (#9462) I noticed the tendermint image was running on Go 1.15. I assume that was just a missed search and replace when updating to go1.18. Pull the go base image into a build arg so that the image is only defined once, and used consistently across all stages of the build. #### PR checklist - [x] Tests written/updated, or no tests needed - [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed - [x] Updated relevant documentation (`docs/`) and code comments, or no documentation updates needed (cherry picked from commit 84bc77cb1fb7dce6dbeb0fa528186c17cce27661) # Conflicts: # CHANGELOG_PENDING.md * Resolve conflict in CHANGELOG_PENDING Signed-off-by: Thane Thomson Signed-off-by: Thane Thomson Co-authored-by: Mark Rushakoff Co-authored-by: Thane Thomson --- CHANGELOG_PENDING.md | 1 + DOCKER/Dockerfile | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 7f51ac1b9..55640b08d 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -50,3 +50,4 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - [consensus] \#9229 fix round number of `enterPropose` when handling `RoundStepNewRound` timeout. (@fatcat22) - [docker] \#9073 enable cross platform build using docker buildx +- [docker] \#9462 ensure Docker image uses consistent version of Go diff --git a/DOCKER/Dockerfile b/DOCKER/Dockerfile index 77d2ad991..df4e3f49a 100644 --- a/DOCKER/Dockerfile +++ b/DOCKER/Dockerfile @@ -1,5 +1,9 @@ +# Use a build arg to ensure that both stages use the same, +# hopefully current, go version. +ARG GOLANG_BASE_IMAGE=golang:1.18-alpine + # stage 1 Generate Tendermint Binary -FROM --platform=$BUILDPLATFORM golang:1.18-alpine as builder +FROM --platform=$BUILDPLATFORM $GOLANG_BASE_IMAGE as builder RUN apk update && \ apk upgrade && \ apk --no-cache add make @@ -8,7 +12,7 @@ WORKDIR /tendermint RUN TARGETPLATFORM=$TARGETPLATFORM make build-linux # stage 2 -FROM golang:1.15-alpine +FROM $GOLANG_BASE_IMAGE LABEL maintainer="hello@tendermint.com" # Tendermint will be looking for the genesis file in /tendermint/config/genesis.json