Skip to content

Commit

Permalink
Retags latest multi-arch image with latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinc committed Dec 17, 2024
1 parent 24e99dd commit 40a9483
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,41 @@ jobs:

build_only:
executor: skaffold
environment:
DOCKER_BUILDKIT: 1
BUILDX_PLATFORMS: linux/amd64
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
docker_layer_caching: false
- run:
name: Install buildx
command: |
BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.19.2/buildx-v0.19.2.linux-amd64"
curl --output docker-buildx \
--silent --show-error --location --fail --retry 3 \
"$BUILDX_BINARY_URL"
mkdir -p ~/.docker/cli-plugins
mv docker-buildx ~/.docker/cli-plugins/
chmod a+x ~/.docker/cli-plugins/docker-buildx
docker buildx install
# Run binfmt
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
- run:
name: Build artifacts w/ Skaffold
command: |
mkdir -p build
skaffold config set --global collect-metrics false
skaffold build -p build-no-push --file-output build/${CIRCLE_SHA1}.json
skaffold build --platform=${BUILDX_PLATFORMS} -p build-no-push --file-output build/${CIRCLE_SHA1}.json
cat build/${CIRCLE_SHA1}.json
skaffold_tag=$(cat build/${CIRCLE_SHA1}.json | jq -r '.builds[0].tag | split("@")[0]')
skaffold_image=$(cat build/${CIRCLE_SHA1}.json | jq -r '.builds[0].imageName')
# docker tag ${skaffold_tag} ${skaffold_image}:latest
docker images
- persist_to_workspace:
root: ~/project
paths:
Expand Down Expand Up @@ -85,8 +110,10 @@ jobs:
skaffold config set --global collect-metrics false
skaffold build --platform=${BUILDX_PLATFORMS} -p build-and-push --file-output build/${CIRCLE_SHA1}.json
# re-tag :latest
cat build/${CIRCLE_SHA1}.json
skaffold_tag=$(cat build/${CIRCLE_SHA1}.json | jq -r '.builds[0].tag | split("@")[0]')
skaffold_image=$(cat build/${CIRCLE_SHA1}.json | jq -r '.builds[0].imageName')
docker pull ${skaffold_tag}
docker tag ${skaffold_tag} ${skaffold_image}:latest
docker push ${skaffold_image}:latest
- persist_to_workspace:
Expand Down

0 comments on commit 40a9483

Please # to comment.