From 61b140b1cd34e95f2c901e157546b59b94fcafd0 Mon Sep 17 00:00:00 2001
From: Andrej Shadura <andrew.shadura@collabora.co.uk>
Date: Wed, 30 Mar 2022 18:19:51 +0200
Subject: [PATCH] Force Ruby 2.7, as lots of things break with 3.0

---
 Dockerfile.frontend-base | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Dockerfile.frontend-base b/Dockerfile.frontend-base
index c8ee2038ff..65a30c8997 100644
--- a/Dockerfile.frontend-base
+++ b/Dockerfile.frontend-base
@@ -23,8 +23,8 @@ RUN apt-get update \
         npm \
         patch \
         pkgconf \
-        ruby \
-        ruby-dev \
+        ruby2.7 \
+        ruby2.7-dev \
         ruby-bundler \
         ruby-ffi \
         ruby-foreman \
@@ -45,7 +45,13 @@ RUN apt-get update \
 ADD src/api/Gemfile src/api/Gemfile.lock $INSTALLDIR/src/api/
 WORKDIR $INSTALLDIR/src/api/
 
-RUN sed -e '/BUNDLED WITH/,+1 d' Gemfile.lock > Gemfile.lock.new; \
+# Force Ruby 2.7 no matter what
+RUN for bin in $(dpkg -L ruby | grep /usr/bin/); do \
+      ln -sf ${bin}2.7 $bin; \
+    done
+RUN echo "ruby '~> 2.7.0'" >> Gemfile
+RUN sed -e '/BUNDLED WITH/,+1 d' Gemfile.lock \
+        -e 's/^  ruby$/  ruby '"$(ruby2.7 -v | cut -d' ' -f2)"'/' > Gemfile.lock.new; \
     diff -u Gemfile.lock Gemfile.lock.new; \
     mv Gemfile.lock.new Gemfile.lock
 
-- 
GitLab