Quantcast
Channel: Active questions tagged dockerfile - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 136

Jenkins Dockerfile declarative pipelines: getting the built image tag

$
0
0

I'm trying to get the image tag generated with the help of the dockerfile agent in Jenkins declarative pipelines.

This Jenkinsfile is incomplete though, because I still need the deployment steps.

Normally, people would then want a step to push to Dockerhub. Although I don't even know how to do that, I want something different: I want to re-tag the built image locally to a name of my choice. This is because this is a hobby project, and my Jenkins and production servers are the same. The problem is that I don't know how to get the dynamically generated image ID for the docker tag command.

(Then what would come next is to swap out the old running image with the new one, but I could probably take care of that myself.)

Here is my Jenkinsfile:

pipeline {    agent {        dockerfile {            args '--network szeremi -e DB_HOST=mysql -e APP_ENV=testing'        }    }    stages {        stage('Run tests') {            steps {                sh 'cd /var/www && php artisan migrate:fresh && vendor/bin/phpunit'            }        }    }}

Please help me use Jenkins declarative pipelines to re-tag my built-by-dockerfile image.


Viewing all articles
Browse latest Browse all 136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>