[evince/wip/gpoo/image-rebuild] ci: Install docker to rebuild image




commit 2ce88d93b1a06bc5c808112f84d7a446b0677f5f
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Thu Aug 25 12:11:45 2022 -0400

    ci: Install docker to rebuild image
    
    * Add a CI stage to rebuild the CI image and update Gitlab's
      registry.
    * Change the tag to use :latest instead of :poppler. Thus, future
      rebuilds will not need manual intervention (or reduce it at least).
    * Use Alpine to build the image, as it is small and it only requires
      buildah and runc.

 .gitlab-ci.yml               | 32 ++++++++++++++++++++++----------
 .gitlab-ci/ubuntu.Dockerfile | 36 +++++++++++++++++++++++++++++++++---
 2 files changed, 55 insertions(+), 13 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5d7a27a8c..3f4569c33 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ variables:
     BUNDLE: "org.gnome.Evince.flatpak"
 
 meson:
-    image: registry.gitlab.gnome.org/gnome/evince/x86_64-ubuntu:poppler
+    image: registry.gitlab.gnome.org/gnome/evince/x86_64-ubuntu:latest
     stage: build
 
     script:
@@ -27,7 +27,7 @@ meson:
         expire_in: 2 days
 
 meson-internal-synctex:
-    image: registry.gitlab.gnome.org/gnome/evince/x86_64-ubuntu:poppler
+    image: registry.gitlab.gnome.org/gnome/evince/x86_64-ubuntu:latest
     stage: build
 
     script:
@@ -65,16 +65,28 @@ nightly:
         - flatpak
     extends: .publish_nightly
 
-update registry image:
-    image: registry.gitlab.gnome.org/gnome/evince/x86_64-ubuntu:poppler
+update image:
+    variables:
+        IMAGE_TAG: $CI_REGISTRY_IMAGE/x86_64-ubuntu
+        # Tell 'docker:dind' to enable TLS (recommended)
+        # and generate certificates in the specified directory.
+        DOCKER_TLS_CERTDIR: "/certs"
+        STORAGE_DRIVER: vfs
+        BUILDAH_FORMAT: docker
+        BUILDAH_ISOLATION: chroot
+    image: alpine:latest
     stage: image
     script:
-        - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-        - docker build -t $CI_REGISTRY_IMAGE -f .gitlab-ci/ubuntu.Dockerfile
+        - apk add --no-cache buildah runc
+        - buildah bud --tag $IMAGE_TAG -f .gitlab-ci/ubuntu.Dockerfile
+        - buildah tag $IMAGE_TAG "$IMAGE_TAG:v$CI_JOB_ID"
+        - buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+        - buildah push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD $IMAGE_TAG
+        - buildah push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD "$IMAGE_TAG:v$CI_JOB_ID"
     when: manual
     only:
-        - web
-        - main
+       - web
+       - main
     except:
-        variables:
-            - $CI_PROJECT_NAMESPACE != "GNOME"
+       variables:
+           - $CI_PROJECT_NAMESPACE != "GNOME"
diff --git a/.gitlab-ci/ubuntu.Dockerfile b/.gitlab-ci/ubuntu.Dockerfile
index 23e4d11e6..edad215d2 100644
--- a/.gitlab-ci/ubuntu.Dockerfile
+++ b/.gitlab-ci/ubuntu.Dockerfile
@@ -1,9 +1,39 @@
 FROM ubuntu:22.04
 
-ENV LANG C.UTF-8
+ENV LANG=C.UTF-8 DEBIAN_FRONTEND=noninteractive
 
-ADD setup-ubuntu.sh /opt/
-RUN /bin/sh /opt/setup-ubuntu.sh
+RUN apt-get -yqq update \
+&& apt-get -yqq install --no-install-recommends \
+    apt-utils \
+&& apt-get -yqq install --no-install-recommends \
+    gnome-common libglib2.0-dev-bin \
+    yelp-tools itstool appstream \
+    libgirepository1.0-dev libgtk-3-dev \
+    libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
+    libxml2-dev libxml2-utils \
+    libarchive-dev \
+    libsecret-1-dev libgspell-1-dev \
+    libgnome-desktop-3-dev libnautilus-extension-dev \
+    libspectre-dev libtiff5-dev libdjvulibre-dev \
+    libkpathsea-dev libgxps-dev libsynctex-dev \
+    git ccache systemd ninja-build meson \
+    cmake \
+&& apt-get -yqq install --no-install-recommends \
+    python3-pip python3-jinja2 python3-toml python3-typogrify \
+&& pip install gi-docgen \
+&& apt-get -yqq install --no-install-recommends \
+    poppler-data libboost-container-dev libopenjp2-7-dev libcurl4-openssl-dev \
+&& git clone --depth 1 --branch poppler-22.07.0 \
+    https://gitlab.freedesktop.org/poppler/poppler.git /tmp/poppler \
+&& cd /tmp/poppler \
+&& cmake -DBUILD_GTK_TESTS=OFF, -DBUILD_CPP_TESTS=OFF, -DENABLE_UTILS=OFF, \
+    -DENABLE_CPP=OFF, -DENABLE_GOBJECT_INTROSPECTION=OFF, \
+    -DENABLE_LIBOPENJPEG=openjpeg2 -DENABLE_QT5=OFF -DENABLE_QT6=OFF \
+    -DBUILD_GTK_TESTS=OFF -DBUILD_CPP_TESTS=OFF -G Ninja . \
+&& ninja && ninja install \
+&& apt-get clean \
+&& rm -rf /tmp/poppler \
+&& useradd -u 1984 -ms /bin/sh user
 
 USER user
 WORKDIR /home/user


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]