Commit 3b590cf9 authored by Pekka Paalanen's avatar Pekka Paalanen

CI: build customized Debian docker image

Build a custom image that contains everything installed as part
of each CI run in the before_script.

The Dockerfile contains instructions on how to submit changes to the
image in upstream without causing temporary CI failures.

The image needs to be identified per build, because it pulls things from
internet that will change over time. That means that an image built from
the same Weston commit may be different if built again. Hence the
unique image tag contains also the build id.

To avoid cluttering forks with unnecessary images, the automatic image
build will happen only on a master branch in the upstream repository and
only if Dockerfile is changed. Contributors can trigger an image build
in their own branches by launching a pipeline from the Web UI with
FORCE_DOCKER variable.
Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <>
parent 00a6e01d
Pipeline #11017 passed with stages
image: debian:stretch image: debian:stretch
stages: stages:
- docker-image
- build - build
stage: docker-image
image: docker:stable
- docker:dind
DISTRIBUTION: debian-stretch-x86_64
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t "$IMAGE_UNIQUE" -t "$IMAGE_BRANCH" .gitlab-ci
- docker push "$IMAGE_UNIQUE"
- docker push "$IMAGE_BRANCH"
- |
if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
docker push "$IMAGE_LATEST"
extends: .debian-stretch-x86_64
- master
- $CI_REGISTRY == ""
- .gitlab-ci/Dockerfile
extends: .debian-stretch-x86_64
- web
before_script: before_script:
- echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft - echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
- echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft - echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
# Debian commands to prepare a Docker image for running Weston test suite
# If you have work that depends on changes in this file:
# To generate a new image for your branch, use the Gitlab web UI to launch
# a new pipeline and define the variable FORCE_DOCKER to anything non-empty.
# You have to submit your work in two different MRs.
# The first MR contains the changes to the Docker image building (this file).
# The second MR will start as WIP until the first MR is merged, and needs to
# include the first MR. Add a temporary commit that changes the CI to use
# the your new image by the name $IMAGE_BRANCH instead of $IMAGE_LATEST as it
# is in upstream master. Add your new development on top. This allows CI to
# run on your second MR before it is merged.
# Once the first MR is merged upstream and the new $IMAGE_LATEST is generated,
# drop the temporary patch and update your second MR. Now CI will run your MR
# against the upstream $IMAGE_LATEST and will be mergeable as usual.
FROM debian:stretch
RUN echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo '#!/bin/sh' > /usr/sbin/policy-rc.d && \
echo 'exit 101' >> /usr/sbin/policy-rc.d && \
chmod +x /usr/sbin/policy-rc.d && \
apt-get update && \
apt-get -y --no-install-recommends install \
autoconf \
automake \
build-essential \
git \
libcairo2-dev \
libcolord-dev \
libegl1-mesa-dev \
libexpat1-dev \
libffi-dev \
libgbm-dev \
libgdk-pixbuf2.0-dev \
libgles2-mesa-dev \
libglu1-mesa-dev \
libinput-dev \
libjpeg-dev \
libjpeg-dev \
liblcms2-dev \
libmtdev-dev \
libpam0g-dev \
libpango1.0-dev \
libpixman-1-dev \
libpng-dev \
libsystemd-dev \
libtool \
libudev-dev \
libva-dev \
libvpx-dev \
libwayland-dev \
libwebp-dev \
libx11-dev \
libx11-xcb-dev \
libxcb1-dev \
libxcb-composite0-dev \
libxcb-xfixes0-dev \
libxcb-xkb-dev \
libxcursor-dev \
libxkbcommon-dev \
libxml2-dev \
mesa-common-dev \
pkg-config \
&& \
mkdir -p /tmp/.X11-unix && \
chmod 777 /tmp/.X11-unix
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment