Skip to content

Commit

Permalink
Automatically fetch & use the latest Maven 3 patch version for Docker…
Browse files Browse the repository at this point in the history
… builds/publish workflow (#203)
  • Loading branch information
msmygit authored Sep 25, 2023
1 parent 38635b8 commit 38860c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ RUN apt-get update && apt-get install -y openssh-server vim python3 --no-install
rm -rf /var/lib/apt/lists/* && \
service ssh start

COPY scripts/get-latest-maven-version.sh ./get-latest-maven-version.sh
RUN chmod +x ./get-latest-maven-version.sh

# Copy CDM jar & template files
ARG MAVEN_VERSION=3.9.3
ARG MAVEN_VERSION=$(./get-latest-maven-version.sh)
ARG USER_HOME_DIR="/root"
ARG BASE_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
ENV MAVEN_HOME /usr/share/maven
Expand Down
10 changes: 10 additions & 0 deletions scripts/get-latest-maven-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

MAVEN_BASE_VERSION=3.9
MAVEN_REPO_URL="https://archive.apache.org/dist/maven/maven-3/"

curl -sSL ${MAVEN_REPO_URL} | \
grep -o "${MAVEN_BASE_VERSION}\.[0-9]*\/" | \
sort -V | \
tail -n1 | \
sed 's/\///'

0 comments on commit 38860c4

Please sign in to comment.