This commit is contained in:
Eric Van Hensbergen
2019-09-29 18:40:40 +00:00
parent 7283b4ce77
commit b636324882
2 changed files with 7 additions and 34 deletions

View File

@ -1,32 +1,6 @@
include:
- template: Auto-DevOps.gitlab-ci.yml
- project: 'ericvh/gitlab-ci-arm-template'
file: '/.gitlab-ci.yml'
# This file is a template, and might need editing before it works on your project.
build-master:
# Official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- master
build:
# Official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
variables:
CI_BUILD_ARCHS: "linux/amd64,linux/arm64"

View File

@ -1,5 +1,4 @@
FROM debian
# Install Docker and qemu
# TODO Use docker stable once it properly supports buildx
RUN apt-get update && apt-get install -y \
@ -9,7 +8,7 @@ RUN apt-get update && apt-get install -y \
gnupg2 \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
apt-get update && apt-get install -y \
docker-ce-cli \
binfmt-support \
@ -17,8 +16,8 @@ RUN apt-get update && apt-get install -y \
# Install buildx plugin
RUN mkdir -p ~/.docker/cli-plugins && \
curl -s https://api.github.com/repos/docker/buildx/releases/latest | \
grep "browser_download_url.*linux-amd64" | cut -d : -f 2,3 | tr -d \" | \
ARCH=`dpkg --print-architecture` && echo Running on $ARCH && curl -s https://api.github.com/repos/docker/buildx/releases/latest | \
grep "browser_download_url.*linux-$ARCH" | cut -d : -f 2,3 | tr -d \" | \
xargs curl -L -o ~/.docker/cli-plugins/docker-buildx && \
chmod a+x ~/.docker/cli-plugins/docker-buildx