This commit is contained in:
Lihan 2024-07-28 00:53:46 -04:00
parent b7bcdf16bd
commit 57045506f4

11
Jenkinsfile vendored
View file

@ -17,12 +17,21 @@ pipeline {
}
}
stage('Prepare Environment') {
steps {
script {
sh "pwd" // Prints the current working directory
sh "ls -alh" // Lists all files in the current directory
}
}
}
stage('Build Docker Image') {
steps {
script {
echo "Building Docker Image..."
// Correctly escape dollar signs in Groovy string
def dockerImage = docker.build("spring-petclinic", "--build-arg CACHEBUSTER=\\$(date +%s) --no-cache .")
def dockerImage = docker.build("spring-petclinic", "--no-cache --build-arg FORCE_REBUILD=$(date +%s) .")
echo "Docker Image built: ${dockerImage.id}"
// Store the Docker image ID in the environment if needed across stages
env.DOCKER_IMAGE_ID = dockerImage.id