Skip to content

Commit 5f60e87

Browse files
authored
Remove (unused/duplicated) OpenJDK from Docker image (#2318)
The Docker image installs `maven` via `apt` which _also_ installs Java (if required), defaulting to OpenJDK. We then subsequently install Eclipse Temurin JDK - rendering OpenJDK redundant, taking up space. If we re-order the steps, OpenJDK will never be installed.
1 parent 0eadea1 commit 5f60e87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ RUN apt-get update && apt-get install -y software-properties-common \
88
&& add-apt-repository ppa:deadsnakes/ppa \
99
&& apt-get update && apt-get install -y \
1010
wget \
11-
maven \
1211
python${PYTHON_VERSION} \
1312
python${PYTHON_VERSION}-distutils \
1413
python3-pip \
@@ -42,6 +41,9 @@ RUN JAVA_HOME_PATH=$(find /usr/lib/jvm -name "temurin-17*" -type d | head -1) &&
4241
echo "export JAVA_HOME=$JAVA_HOME_PATH" >> /etc/environment && \
4342
echo "export JAVA_HOME=$JAVA_HOME_PATH" >> /etc/bash.bashrc
4443

44+
# Install Maven after JDK has been installed to avoid default JDK installation
45+
RUN apt-get update && apt-get install -y maven && rm -rf /var/lib/apt/lists/*
46+
4547
# Install Terraform
4648
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
4749
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list && \

0 commit comments

Comments
 (0)