From 920ea8d8433aef14f02423a02d77acae37f8c689 Mon Sep 17 00:00:00 2001
From: Tim Bo <7645199+timbrd@users.noreply.github.com>
Date: Mon, 17 Feb 2020 09:38:10 +0100
Subject: [PATCH] fix(deps): Update git to latest stable version (#5493)

Solves an issue with sorting git tags

Closes #5477
---
 Dockerfile      | 10 ++++++++--
 Dockerfile.slim |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index bd89e8cfd9..b933ee2244 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,11 +24,17 @@ ENV DEBIAN_FRONTEND noninteractive
 ENV LC_ALL C.UTF-8
 ENV LANG C.UTF-8
 
-RUN apt-get update && apt-get install -y gpg curl wget unzip xz-utils git openssh-client bsdtar build-essential && \
+RUN apt-get update && apt-get install -y gpg curl wget unzip xz-utils openssh-client bsdtar build-essential && \
     rm -rf /var/lib/apt/lists/*
 
-## Gradle
+# The git version of ubuntu 18.04 is too old to sort ref tags properly (see #5477), so update it to the latest stable version
+RUN echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main\ndeb-src http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/git.list && \
+    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E1DD270288B4E6030699E45FA1715D88E1DF1F24 && \
+    apt-get update && \
+    apt-get -y install git && \
+    rm -rf /var/lib/apt/lists/*
 
+## Gradle
 RUN apt-get update && apt-get install -y --no-install-recommends openjdk-11-jre-headless gradle && \
     rm -rf /var/lib/apt/lists/*
 
diff --git a/Dockerfile.slim b/Dockerfile.slim
index 7fd006ad6a..a17da59b75 100644
--- a/Dockerfile.slim
+++ b/Dockerfile.slim
@@ -50,6 +50,13 @@ FROM base as final
 # required for install
 USER root
 
+# The git version of ubuntu 18.04 is too old to sort ref tags properly (see #5477), so update it to the latest stable version
+RUN echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main\ndeb-src http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/git.list && \
+    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E1DD270288B4E6030699E45FA1715D88E1DF1F24 && \
+    apt-get update && \
+    apt-get -y install git && \
+    rm -rf /var/lib/apt/lists/*
+
 # Docker client and group
 
 RUN groupadd -g 999 docker
-- 
GitLab