This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new b1b90641d01 SOLR-16752: Reduce attack surface and size for Docker
image (#1575)
b1b90641d01 is described below
commit b1b90641d012718d7561fb89996405733d05861e
Author: Bui Quang Cuong <[email protected]>
AuthorDate: Wed Apr 19 17:14:45 2023 +0200
SOLR-16752: Reduce attack surface and size for Docker image (#1575)
(cherry picked from commit 8a0bf24357ce3f083e9fdf4c66ae7ebf08beacee)
---
solr/CHANGES.txt | 2 ++
solr/docker/templates/Dockerfile.body.template | 2 +-
solr/docker/templates/Dockerfile.official.header.template | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 093aa5dec42..fd110864981 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -52,6 +52,8 @@ Improvements
* SOLR-16504: Convert CLI tools to use Jetty HTTP 2 client. (Bence Szabo via
Eric Pugh)
+* SOLR-16752: Docker: Leave out optional apt packages, slightly reducing image
size and lowering attack surface (Quang-Cuong Bui)
+
Optimizations
---------------------
diff --git a/solr/docker/templates/Dockerfile.body.template
b/solr/docker/templates/Dockerfile.body.template
index ea627e2a6c5..7282642a73f 100644
--- a/solr/docker/templates/Dockerfile.body.template
+++ b/solr/docker/templates/Dockerfile.body.template
@@ -70,7 +70,7 @@ RUN set -ex; \
RUN set -ex; \
apt-get update; \
- apt-get -y install acl lsof procps wget netcat gosu tini jattach; \
+ apt-get -y --no-install-recommends install acl lsof procps wget netcat
gosu tini jattach; \
rm -rf /var/lib/apt/lists/*;
VOLUME /var/solr
diff --git a/solr/docker/templates/Dockerfile.official.header.template
b/solr/docker/templates/Dockerfile.official.header.template
index 96bf2e51edd..3a69f3e756d 100644
--- a/solr/docker/templates/Dockerfile.official.header.template
+++ b/solr/docker/templates/Dockerfile.official.header.template
@@ -45,7 +45,7 @@ ARG
SOLR_ARCHIVE_URL="https://archive.apache.org/dist/solr/solr/$SOLR_VERSION/so
RUN set -ex; \
apt-get update; \
- apt-get -y install wget gpg dirmngr; \
+ apt-get -y --no-install-recommends install wget gpg gnupg dirmngr; \
rm -rf /var/lib/apt/lists/*; \
export GNUPGHOME="/tmp/gnupg_home"; \
mkdir -p "$GNUPGHOME"; \