Issue
I'm trying to write a script that creates a Docker image from a Jenkins image, that is, the first line of my Dockerfile is...
FROM jenkins/jenkins:2.249.3
However I wanna be smart and write a script that gets the latest Jenkins stable version and sed that into my Dockerfile, like this
Dockerfile:
FROM jenkins/jenkins:JENKINS_LATEST_STABLE_VER
$ export JENKINS_LATEST_STABLE_VER=`some_api_call`
$ sed -i "s/JENKINS_LATEST_STABLE_VER/$JENKINS_LATEST_STABLE_VER/g" Dockerfile
$ docker build ...
What is "some_api_call"?
Solution
latest stable:
curl -L --max-redirs 2 https://updates.jenkins.io/stable/latestCore.txt
latest current:
curl -L --max-redirs 2 https://updates.jenkins.io/current/latestCore.txt
Answered By - Sentient Answer Checked By - Pedro (WPSolving Volunteer)