path: root/.gitlab-ci.yml
diff options
authorMichel Dänzer <>2018-12-11 11:47:16 +0100
committerMichel Dänzer <>2018-12-11 11:47:16 +0100
commitbe862ed459b06ab7dfc80b5c3d1e2ac7e9327a6e (patch)
treee1f29f1209be243bfb0e14b135e6ff69ccad3f3d /.gitlab-ci.yml
parentb11ee02c4596ddee3c9ff2141be5c91815efacc3 (diff)
Generate docker image as part of CI pipeline
This removes the dependency on an externally generated docker image, and should make it easier to update the docker image or make other changes related to it. v2: * If the image doesn't exist, try pulling it from the main repo's registry. * Use debian:testing-slim as the base, might result in a slightly smaller image. v3: * Prevent installation of packages which are only recommended, for an even smaller image. * Add recommendation to remove new image from source repository in favour of the main repository's. Acked-by: Alex Deucher <> # v2
Diffstat (limited to '.gitlab-ci.yml')
1 files changed, 37 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aac8bb7..d1960fb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,8 +1,43 @@
+# IMAGE_TAG is the tag of the docker image used for the build jobs. If the
+# image doesn't exist yet, the docker-image stage generates it.
+# In order to generate a new image, one should generally change the tag.
+# While removing the image from the registry would also work, that's not
+# recommended except for ephemeral images during development: Replacing an
+# image after a significant amount of time might pull in newer versions of
+# gcc/clang or other packages, which might break the build with older commits
+# using the same tag.
+# After merging a change resulting in generating a new image to the main
+# repository, it's recommended to remove the image from the source repository's
+# container registry, so that the image from the main repository's registry
+# will be used there as well.
+ IMAGE_TAG: "debian-testing-20181213"
+ - docker-image
- build
+ stage: docker-image
+ image: docker:stable
+ services:
+ - docker:dind
+ before_script:
+ - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
+ script:
+ - docker pull "$IMAGE_LOCAL" ||
+ ((docker pull "$IMAGE_MAIN" && docker tag "$IMAGE_MAIN" "$IMAGE_LOCAL") ||
+ docker build -t "$IMAGE_LOCAL" .gitlab-ci;
+ docker push "$IMAGE_LOCAL")
+image: $IMAGE_LOCAL
# The default build instructions
stage: build
@@ -44,7 +79,7 @@ xserver-1.14:
- extends: .default_build
+ extends: xserver-1.14