Commit be862ed4 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer
Browse files

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 <alexander.deucher@amd.com> # v2
parent b11ee02c
Pipeline #12059 passed with stages
in 15 minutes and 24 seconds
image: registry.freedesktop.org/xorg/driver/xf86-video-amdgpu:debian-testing-20181003
# 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.
variables:
IMAGE_TAG: "debian-testing-20181213"
IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
IMAGE_MAIN: "registry.freedesktop.org/xorg/driver/$CI_PROJECT_NAME:$IMAGE_TAG"
stages:
- docker-image
- build
debian-testing:
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
.default_build:
stage: build
......@@ -44,7 +79,7 @@ xserver-1.14:
XSERVER_VERSION: "1.14"
xserver-1.15:
extends: .default_build
extends: xserver-1.14
variables:
XSERVER_VERSION: "1.15"
......
FROM debian:testing-slim
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive; \
echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'APT::Get::Build-Dep-Automatic "true";' > /etc/apt/apt.conf && \
echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf && \
echo '#!/bin/sh' > /usr/sbin/policy-rc.d && \
echo 'exit 101' >> /usr/sbin/policy-rc.d && \
chmod +x /usr/sbin/policy-rc.d && \
echo 'deb-src https://deb.debian.org/debian testing main' >/etc/apt/sources.list.d/deb-src.list && \
apt-get update && \
apt-get install -y git ca-certificates build-essential automake autoconf libtool pkg-config && \
apt-get build-dep -y xorg-server && \
\
git clone https://gitlab.freedesktop.org/xorg/lib/libXfont.git && \
cd libXfont && \
git checkout libXfont-1.5-branch && \
./autogen.sh && \
make install-pkgconfigDATA && \
cd .. && rm -rf libXfont && \
git clone https://gitlab.freedesktop.org/xorg/xserver.git && \
cd xserver && \
git checkout server-1.13-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.13 --enable-dri2 && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.14-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.14 --enable-dri2 && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.15-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.15 --enable-dri2 && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.16-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.16 --enable-dri2 --enable-dri3 --enable-glamor && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.17-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.17 --enable-dri2 --enable-dri3 --enable-glamor && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.18-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.18 --enable-dri2 --enable-dri3 --enable-glamor && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.19-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.19 --enable-dri2 --enable-dri3 --enable-glamor && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
git checkout server-1.20-branch && \
./autogen.sh --prefix=/usr/local/xserver-1.20 --enable-dri2 --enable-dri3 --enable-glamor && \
make -C include install-nodist_sdkHEADERS && \
make install-headers install-aclocalDATA install-pkgconfigDATA clean && \
cd .. && rm -rf xserver && \
\
apt-get install -y clang xutils-dev libdrm-dev libgl1-mesa-dev libgbm-dev libudev-dev \
x11proto-dev libpixman-1-dev libpciaccess-dev && \
apt-get purge -y git ca-certificates && apt-get autoremove -y --purge && \
apt-get clean && rm -f /var/lib/apt/lists/deb.debian.org_debian_dists_testing_*
Supports Markdown
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