Always use GHCR when building the docker image

when splitting the image, depending on the platform, docker buildx
cannot always see the imported image. So, we'll just push to GHCR
always. Members of the rabbitmq github org can log into GHCR, and be
able to perform local builds of the image
This commit is contained in:
Rin Kuryloski 2024-04-08 18:12:00 +02:00
parent 9b4486ac0f
commit 09f2190606
3 changed files with 5 additions and 11 deletions

View File

@ -59,7 +59,6 @@ jobs:
build:buildbuddy --color=yes build:buildbuddy --color=yes
build --action_env EXTRA_BUILDX_OPTS="--cache-from=type=gha --cache-to=type=gha" build --action_env EXTRA_BUILDX_OPTS="--cache-from=type=gha --cache-to=type=gha"
build --action_env TEMP_REGISTRY="ghcr.io/rabbitmq/"
EOF EOF
- name: Build package-generic-unix - name: Build package-generic-unix

View File

@ -48,27 +48,22 @@ CONTEXT="$$(mktemp -d)"
cp $(locations :context-files) "$$CONTEXT" cp $(locations :context-files) "$$CONTEXT"
BASE_IMAGE="$${{TEMP_REGISTRY:=}}rabbitmq-base:{arch}" BASE_IMAGE="ghcr.io/rabbitmq/rabbitmq-base"
set -x set -x
docker import \\ docker import \\
--platform linux/{arch} \\ --platform linux/{arch} \\
"$(location //packaging/base-image:image-{arch}.tar)" \\ "$(location //packaging/base-image:image-{arch}.tar)" \\
$$BASE_IMAGE $$BASE_IMAGE:{arch}
if [[ -n "$${{TEMP_REGISTRY}}" ]]; then DIGEST="$$(docker push $$BASE_IMAGE:{arch} | sed -n 's/.*\\(sha256:[a-z0-9]*\\).*/\\1/p')"
DIGEST="$$(docker push $$BASE_IMAGE | sed -n 's/.*\\(sha256:[a-z0-9]*\\).*/\\1/p')"
# if we are pushing to the temp registry, then we use
# the digest to avoid race conditions on the tag
BASE_IMAGE="$${{TEMP_REGISTRY:=}}rabbitmq-base@$$DIGEST"
fi
docker buildx \\ docker buildx \\
build \\ build \\
"$$CONTEXT" \\ "$$CONTEXT" \\
--platform linux/{arch} \\ --platform linux/{arch} \\
--build-arg BASE_IMAGE="$$BASE_IMAGE" \\ --build-arg BASE_IMAGE="$$BASE_IMAGE@$$DIGEST" \\
--build-arg RABBITMQ_VERSION="{rmq_version}" \\ --build-arg RABBITMQ_VERSION="{rmq_version}" \\
--output type=tar,dest=$(location image-{arch}.tar) $${{EXTRA_BUILDX_OPTS:-}} --output type=tar,dest=$(location image-{arch}.tar) $${{EXTRA_BUILDX_OPTS:-}}
""".format( """.format(

View File

@ -1,4 +1,4 @@
ARG BASE_IMAGE=pivotalrabbitmq/rabbitmq-base:latest ARG BASE_IMAGE=ghcr.io/rabbitmq/rabbitmq-base:amd64
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
ENV ERLANG_INSTALL_PATH_PREFIX /opt/erlang ENV ERLANG_INSTALL_PATH_PREFIX /opt/erlang