CI: add job to build the docker image

This defines a template for building docker images as well as a
job to build the fedora image thats mean to replace the one
that's currently used.

Close #381
This commit is contained in:
Jordan Petridis 2018-11-11 22:32:14 +02:00
parent 1dff74e71c
commit 2bc69242a8
No known key found for this signature in database
GPG Key ID: E8523968931763BE

View File

@ -1,11 +1,45 @@
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
stages:
- docker-image
- build
build-mutter:
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
stage: build
script:
- meson . build -Degl_device=true -Dwayland_eglstream=true
- ninja -C build
- ninja -C build install
.docker base:
image: 'docker:stable'
services:
- docker:dind
script:
- export IMAGE="${CI_REGISTRY_IMAGE}/${ARCH}/${TAG}"
- export REF="${IMAGE}:${CI_COMMIT_SHA}"
- export LATEST="${IMAGE}:latest"
- docker build --pull -t ${REF} ${CONTEXT_DIR}
- docker image tag ${REF} ${LATEST}
# Push the images
- |
if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
docker push ${REF}
docker push ${LATEST}
fi
docker fedora amd64:
extends: '.docker base'
stage: 'docker-image'
variables:
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: 'overlay2'
ARCH: 'amd64'
TAG: 'fedora'
CONTEXT_DIR: '.gitlab-ci/'
only:
changes:
- '.gitlab-ci/Dockerfile'