trying to get to build without self-dependency

This commit is contained in:
Gareth Dunstone
2020-07-06 14:39:41 +10:00
parent 2eae422256
commit 0221c75ca9
3 changed files with 53 additions and 1 deletions

View File

@ -27,6 +27,7 @@ variables:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
build:buildx-master:
image: docker:dind
extends: .build
only:
refs:
@ -42,6 +43,7 @@ build:buildx-master:
- docker buildx build --platform $CI_BUILDX_ARCHS --progress plain --pull -t "$CI_REGISTRY_IMAGE" --push .
build:buildx:
image: docker:dind
extends: .build
only:
variables:

46
original-gitlab-ci.yml Normal file
View File

@ -0,0 +1,46 @@
image: jonoh/docker-buildx-qemu
variables:
DOCKER_HOST: tcp://docker:2375/
PLATFORM: local
DOCKER_IMAGE_TAG: latest
DOCKER_PREBUILD_CMD: echo
services:
- docker:dind
.docker_before_script: &docker_before_script
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull "$CI_REGISTRY_IMAGE" || true
- '[[ "$PLATFORM" != "local" ]] && update-binfmts --enable'
# Use docker-container driver to allow useful features (push/multi-platform)
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
build:
stage: build
before_script: *docker_before_script
script:
- $DOCKER_PREBUILD_CMD
- docker buildx build
--pull
--cache-from "$CI_REGISTRY_IMAGE"
--platform "$PLATFORM"
-t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
--push $EXTRA_BUILD_ARGS .
only:
- master
build-unstable:
stage: build
before_script: *docker_before_script
script:
- $DOCKER_PREBUILD_CMD
- docker buildx build
--pull
--cache-from "$CI_REGISTRY_IMAGE"
--platform "$PLATFORM"
-t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
--push $EXTRA_BUILD_ARGS .
except:
- master

View File

@ -1,5 +1,9 @@
# docker-buildx-qemu
> this is a fork of https://gitlab.com/ericvh/docker-buildx-qemu
> it has been modified to not depend on a gitlab-ci template repository.
This Debian-based image allows you to easily build cross-platform images.
It's been tested with GitLab CI on gitlab.com, but it should work anywhere that docker-in-docker already works, and with a binfmt_misc enabled kernel.
@ -34,7 +38,7 @@ build:
DOCKER_TLS_CERTDIR: ""
retry: 2
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Use docker-container driver to allow useful features (push/multi-platform)
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
- docker buildx create --driver docker-container --use