util-docker: Add 'ubuntu-22.04_gcc-version'

Now that ubuntu 22.04 has been released we can use it to test newer GCC
compilers. GCC-11 has been moved to use this image.

Change-Id: I3b0dbd82112068f19682e5cf19ffbe81f3d18149
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64173
Reviewed-by: Kunal Pai <kunpai@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/util/dockerfiles/docker-compose.yaml b/util/dockerfiles/docker-compose.yaml
index 103c221..53111f1 100644
--- a/util/dockerfiles/docker-compose.yaml
+++ b/util/dockerfiles/docker-compose.yaml
@@ -66,7 +66,7 @@
         image: gcr.io/gem5-test/gcc-version-10
     gcc-11:
         build:
-            context: ubuntu-20.04_gcc-version-11
+            context: ubuntu-22.04_gcc-version
             dockerfile: Dockerfile
             args:
                 - version=11
diff --git a/util/dockerfiles/ubuntu-20.04_gcc-version-11/Dockerfile b/util/dockerfiles/ubuntu-22.04_gcc-version/Dockerfile
similarity index 70%
rename from util/dockerfiles/ubuntu-20.04_gcc-version-11/Dockerfile
rename to util/dockerfiles/ubuntu-22.04_gcc-version/Dockerfile
index f01479d5..121ac37 100644
--- a/util/dockerfiles/ubuntu-20.04_gcc-version-11/Dockerfile
+++ b/util/dockerfiles/ubuntu-22.04_gcc-version/Dockerfile
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 The Regents of the University of California
+# Copyright (c) 2022 The Regents of the University of California
 # All Rights Reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -23,29 +23,25 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-FROM ubuntu:20.04
+FROM ubuntu:22.04
 
-# At the time of this Dockerfile's creation, Ubuntu 20.04 APT does not
-# distribute gcc-11 by default. A special APT repository is needed. We hope
-# this Dockerfile will merge with ubuntu-20.04_gcc-version once GCC-11 can be
-# installed via APT more easily.
+# Valid version values:
+# 11
+
+ARG version
 
 ENV DEBIAN_FRONTEND=noninteractive
 RUN apt -y update && apt -y upgrade && \
     apt -y install git m4 scons zlib1g zlib1g-dev libprotobuf-dev \
     protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev \
-    python-is-python3 doxygen libboost-all-dev libhdf5-serial-dev \
-    python3-pydot libpng-dev make software-properties-common
-
-RUN add-apt-repository \
-    'deb http://mirrors.kernel.org/ubuntu hirsute main universe'
-RUN apt -y install gcc-11 g++-11
+    doxygen libboost-all-dev libhdf5-serial-dev python3-pydot libpng-dev \
+    gcc-${version} g++-${version} make
 
 RUN update-alternatives --install \
-    /usr/bin/g++ g++ /usr/bin/g++-11 100
+    /usr/bin/g++ g++ /usr/bin/g++-${version} 100
 RUN update-alternatives --install \
-    /usr/bin/gcc gcc /usr/bin/gcc-11 100
+    /usr/bin/gcc gcc /usr/bin/gcc-${version} 100
 RUN update-alternatives --install \
-    /usr/bin/c++ c++ /usr/bin/g++-11 100
+    /usr/bin/c++ c++ /usr/bin/g++-${version} 100
 RUN update-alternatives --install \
-    /usr/bin/cc cc /usr/bin/gcc-11 100
+    /usr/bin/cc cc /usr/bin/gcc-${version} 100