From d783273b05d162c163e5afc57e5b553f21913db4 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 18 Nov 2021 18:10:08 -0800 Subject: [PATCH] Update build image workflow. (#361) Push the builder image to ghcr.io instead of dockerhub. Clean up the proto builder Dockerfile. --- .github/workflows/proto-dockerfile.yml | 22 +++++++++++++--------- proto/Dockerfile | 11 +++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/proto-dockerfile.yml b/.github/workflows/proto-dockerfile.yml index 50cbd37b1..559d08ed5 100644 --- a/.github/workflows/proto-dockerfile.yml +++ b/.github/workflows/proto-dockerfile.yml @@ -5,9 +5,8 @@ # should merge the updates first and wait for this workflow to complete, # so that the changes will be available for the dependent workflows. # -# TODO(#7272): Update the target location of the builder image. -name: Build & Push TM Proto Builder +name: Build & Push Proto Builder Image on: pull_request: paths: @@ -21,15 +20,19 @@ on: # run this job once a month to recieve any go or buf updates - cron: "* * 1 * *" +env: + REGISTRY: ghcr.io + IMAGE_NAME: tendermint/docker-build-proto + jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.4.0 - - name: Prepare + - name: Check out and assign tags id: prep run: | - DOCKER_IMAGE=tendermintdev/docker-build-proto + DOCKER_IMAGE="${REGISTRY}/${IMAGE_NAME}" VERSION=noop if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} @@ -42,16 +45,17 @@ jobs: TAGS="${DOCKER_IMAGE}:${VERSION}" echo ::set-output name=tags::${TAGS} - - name: Set up Docker Buildx + - name: Set up docker buildx uses: docker/setup-buildx-action@v1.6.0 - - name: Login to DockerHub + - name: Log in to the container registry uses: docker/login-action@v1.10.0 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to Docker Hub + - name: Build and publish image uses: docker/build-push-action@v2.7.0 with: context: ./proto diff --git a/proto/Dockerfile b/proto/Dockerfile index a3582d494..92fff39e6 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -1,19 +1,14 @@ # This Dockerfile defines an image containing tools for linting, formatting, # and compiling the Tendermint protos. - -FROM bufbuild/buf:latest as buf - FROM golang:1.17-alpine # Install a commonly used set of programs for use with our protos. # clang-extra-tools is included here because it provides clang-format, # used to format the .proto files. -RUN apk add --update --no-cache build-base clang-extra-tools curl git && \ - apk add --update --no-cache build-base clang-extra-tools curl git go && \ - rm -rf /var/cache/apk/* +RUN apk add --no-cache build-base clang-extra-tools curl git ENV GOLANG_PROTOBUF_VERSION=1.3.1 \ - GOGO_PROTOBUF_VERSION=1.3.2 + GOGO_PROTOBUF_VERSION=1.3.2 # Retrieve the go protoc programs and copy them into the PATH RUN go install github.com/golang/protobuf/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \ @@ -22,4 +17,4 @@ RUN go install github.com/golang/protobuf/protoc-gen-go@v${GOLANG_PROTOBUF_VERSI mv "$(go env GOPATH)"/bin/* /usr/local/bin/ # Copy the 'buf' program out of the buildbuf/buf container. -COPY --from=buf /usr/local/bin/* /usr/local/bin/ +COPY --from=bufbuild/buf:latest /usr/local/bin/* /usr/local/bin/