From ad31b38f7cbf60907597c9e093214e75479fa767 Mon Sep 17 00:00:00 2001 From: Zedifus Date: Wed, 22 Sep 2021 18:42:14 +0100 Subject: [PATCH] Remove buildx build step as can curl pre-built --- .gitlab-ci.yml | 52 +++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d489c583..5209610e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,7 @@ stages: -- buildx - build-dev - build-prod -buildx: - image: docker:git - services: - - docker:dind - stage: buildx - rules: - - if: $CI_COMMIT_BRANCH == 'dev' - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - variables: - GIT_STRATEGY: none - tags: - - docker - artifacts: - paths: - - buildx - expire_in: 1 hour - script: - - export DOCKER_BUILDKIT=1 - - git clone git://github.com/docker/buildx ./docker-buildx - - docker build --platform=local -o . ./docker-buildx - docker-build-dev: image: docker:latest services: @@ -37,10 +15,17 @@ docker-build-dev: environment: name: development before_script: - - mkdir -p ~/.docker/cli-plugins - - mv buildx ~/.docker/cli-plugins/docker-buildx - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY + - | + apk --no-cache add curl + latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p') + echo "Using buildx version $latest_tag" + curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64" + chmod a+x docker-buildx + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/docker-buildx + docker version + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | tag=":$CI_COMMIT_REF_SLUG" @@ -71,10 +56,17 @@ docker-build-prod: environment: name: production before_script: - - mkdir -p ~/.docker/cli-plugins - - mv buildx ~/.docker/cli-plugins/docker-buildx - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY + - | + apk --no-cache add curl + latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p') + echo "Using buildx version $latest_tag" + curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64" + chmod a+x docker-buildx + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/docker-buildx + docker version + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY script: - | tag=""