From fdd14215401de8e9b39eb2879fdeee58667669ee Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Thu, 23 May 2024 12:29:25 +0100 Subject: [PATCH] fix: fetch the registry's `main` branch in the monorepo Docker image (#3841) ### Description Infra services require the presence of a registry. This is expected to be found at the env var REGISTRY_URI. This PR fetches the latest registry from `main` and uses that as the registry in the monorepo image for infra services / scripts to make use of. To prevent caching of this git clone, we use a build-time arg such that if the arg changes, any later layers in the image will be ran. See https://stackoverflow.com/a/73501716 ### Drive-by changes ### Related issues - Partially fixes https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3827 - we'll need a deploy to fully close it out ### Backward compatibility ### Testing --- .github/workflows/monorepo-docker.yml | 5 +++++ Dockerfile | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/monorepo-docker.yml b/.github/workflows/monorepo-docker.yml index 72a0fc1f1..b9d90db2b 100644 --- a/.github/workflows/monorepo-docker.yml +++ b/.github/workflows/monorepo-docker.yml @@ -8,6 +8,8 @@ on: paths: # For now, because this image is only used to use `infra`, we just build for infra changes - 'typescript/infra/**' + - 'Dockerfile' + - '.dockerignore' concurrency: group: build-push-monorepo-${{ github.ref }} cancel-in-progress: true @@ -74,3 +76,6 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + # To always fetch the latest registry, we use the date as the cache key + build-args: | + REGISTRY_CACHE=${{ steps.taggen.outputs.TAG_DATE }} diff --git a/Dockerfile b/Dockerfile index 4a01616b8..763e1186f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,3 +27,10 @@ COPY typescript ./typescript COPY solidity ./solidity RUN yarn build + +ENV REGISTRY_URI="/hyperlane-registry" +# To allow us to avoid caching the registry clone, we use a build-time arg to force +# the below steps to be re-run if this arg is changed. +ARG REGISTRY_CACHE="default" + +RUN git clone https://github.com/hyperlane-xyz/hyperlane-registry.git "$REGISTRY_URI"