refs #5541 Tag image
gitea/mylogger/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-04-11 13:36:57 +02:00
parent aa2328db65
commit 610f90c662
2 changed files with 6 additions and 1 deletions

5
Jenkinsfile vendored
View File

@ -22,12 +22,17 @@ pipeline {
stage('Build') { stage('Build') {
when {branch 'master'} when {branch 'master'}
environment { environment {
IMAGE = 'registry.verdnatura.es/mylogger'
TAG = "${env.VERSION}-build${env.BUILD_ID}"
CREDENTIALS = credentials('docker-registry') CREDENTIALS = credentials('docker-registry')
} }
steps { steps {
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY' sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel' sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
sh 'docker-compose push' sh 'docker-compose push'
sh 'docker tag $IMAGE:$TAG $IMAGE:latest'
sh 'docker push $IMAGE:latest'
} }
} }
} }

View File

@ -1,7 +1,7 @@
version: '3.7' version: '3.7'
services: services:
main: main:
image: registry.verdnatura.es/mylogger:${VERSION}-build${BUILD_ID} image: registry.verdnatura.es/mylogger:${TAG:-latest}
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile