Created
May 28, 2020 19:58
-
-
Save carlallen/781a3e40247cff021a7e77de5fb81a47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables: | |
DOCKER_DRIVER: overlay2 | |
DOCKER_HOST: tcp://docker:2375/ | |
DOCKER_BUILDKIT: 1 | |
build: | |
stage: build | |
services: | |
- name: docker:dind | |
command: ["dockerd", "--host=tcp://0.0.0.0:2375"] | |
alias: 'docker' | |
image: carlallen/docker:buildx | |
before_script: | |
- docker buildx create --driver=docker-container --name=buildkit-builder --use | |
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com | |
script: | | |
docker buildx build \ | |
--cache-from type=registry,ref=$CI_REGISTRY_IMAGE:cache \ | |
--cache-to type=registry,ref=$CI_REGISTRY_IMAGE:cache \ | |
--push \ | |
--tag $CI_REGISTRY_IMAGE:latest \ | |
. | |
only: | |
- master |
I don't do multi-arch builds, I use other expirimental features in buildx
I was referring more to the cache image. Any issues there?
…On Thu, May 20, 2021, 12:14 AM Carl Allen ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
I don't do multi-arch builds, I use other expirimental features in buildx
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/781a3e40247cff021a7e77de5fb81a47#gistcomment-3749729>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABY7NLP2HSCPQPOFKFIAKIDTOSECTANCNFSM45FIN26A>
.
Oh, I feel like making new cache images is weird since something changed, but I haven't done that in a while. I do know that cache images can not be deleted in the registry unless you push a real image over the same tag and then delete it.
Interesting... Thanks for the info!
Thank you very much! For a long time I was puzzled about how to generate an image for ARM64 and AMD64, I ended up getting it this way:
build:
stage: build
services:
- name: docker:dind
command: ["dockerd", "--host=tcp://0.0.0.0:2375"]
alias: 'docker'
image: carlallen/docker:buildx
before_script:
- docker buildx create --driver=docker-container --name=buildkit-builder --use
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script: |
docker buildx build \
--cache-from type=registry,ref=$CI_REGISTRY_IMAGE:cache \
--cache-to type=registry,ref=$CI_REGISTRY_IMAGE:cache \
--platform linux/arm64,linux/amd64 \
--push \
--tag $CI_REGISTRY_IMAGE:latest \
.
sadly carlallen/docker:buildx seems to be gone 😞
Yeah, I did a docker cleanup and I haven't been keeping that image up to date. I think this image should work: https://hub.docker.com/r/snickch/buildx
Thank you for the response!
.docker_build_img:
# The stage must come before the stage in which the step is needed
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- docker version
- docker info
- docker buildx create --driver=docker-container --name=buildkit-builder --use
script:
- echo -n $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
- docker pull $IMGNAME:latest || true
- docker buildx build . --platform linux/arm/v7 -f $DOCKERFILE --cache-from $IMGNAME:latest -t $IMGNAME:$TAG --load
- docker push $IMGNAME:$TAG
This ended up working for me as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@carlallen Is this working for you well? I've ran into https://forum.gitlab.com/t/container-registry-docker-buildx-support/52468/2