From 1f0948be99aa52a0c01a2da07449105792e2f96b Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Wed, 16 Mar 2022 10:49:49 -0700
Subject: [PATCH] Use add instead of wget to download things for gerrit images

The jitsi image showed you can ADD a url. Instead of installing wget
into the images and wgetting in a shell, use ADD. Presumably this
will help docker cache things better?

Change-Id: I7bc92952804c1257fc6569e3847d898ab2385eeb
---
 docker/gerrit/base/Dockerfile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docker/gerrit/base/Dockerfile b/docker/gerrit/base/Dockerfile
index 0387541244..a553752462 100644
--- a/docker/gerrit/base/Dockerfile
+++ b/docker/gerrit/base/Dockerfile
@@ -25,8 +25,7 @@ FROM docker.io/library/openjdk:11-bullseye as gerrit-base
 RUN echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/95disable-recommends
 
 RUN apt-get update \
-  && apt-get install -y dumb-init python3-launchpadlib python3-distutils \
-      wget unzip \
+  && apt-get install -y dumb-init python3-launchpadlib python3-distutils unzip \
   && apt-get clean \
   && rm -rf /var/lib/apt/lists/* \
   && curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py \
@@ -60,8 +59,9 @@ RUN mkdir /var/gerrit/bin \
 # Download mariadb java client.
 # Modern gerrit stopped downloading missing libs during init which means we
 # need to do the downland and install ourselves.
-RUN mkdir /var/gerrit/lib && \
-  wget https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.7.2/mariadb-java-client-2.7.2.jar -O /var/gerrit/lib/mariadb-java-client.jar
+# Note the perms on this are 0600 hence the need for the chown otherwise
+# they are root owned and Gerrit can't use the jdbc driver.
+ADD --chown=gerrit:gerrit https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.7.2/mariadb-java-client-2.7.2.jar /var/gerrit/lib/mariadb-java-client.jar
 
 # Allow incoming traffic
 # OpenDev Gerrit listens on 8081 not default of 8080