This commit is contained in:
l.gabrysiak 2024-08-21 14:39:06 +02:00
parent 2a2aea4757
commit 2f76919c1e
1 changed files with 20 additions and 8 deletions

28
Jenkinsfile vendored
View File

@ -1,20 +1,20 @@
pipeline {
agent {
node {
label 'agent-1'
customWorkspace './agent'
}
}
agent any
environment {
DOCKER_IMAGE = 'my-local-image-name'
DOCKER_IMAGE = 'docker.cloud.pokash.pl/szkolenia.riskoff.pl'
DOCKER_REGISTRY = 'https://docker.cloud.pokash.pl'
GIT_REPO = 'https://repo.pokash.pl/POKASH.PL/SzkoleniaRiskoff.git'
REGISTRY_CREDENTIALS_ID = '2753fc17-5ad1-4c78-b86a-a3e54c543adc' // ID poświadczeń do lokalnego rejestru
}
stages {
stage('Checkout') {
steps {
git url: "${GIT_REPO}", branch: 'main'
}
}
stage('Build Docker Image') {
steps {
script {
@ -22,10 +22,22 @@ pipeline {
}
}
}
stage('Push Docker Image') {
steps {
script {
// Logowanie do lokalnego rejestru
docker.withRegistry("http://${DOCKER_REGISTRY}", "${REGISTRY_CREDENTIALS_ID}") {
docker.image("${DOCKER_IMAGE}:latest").push('latest')
}
}
}
}
}
post {
always {
cleanWs()
cleanWs() // Czyści workspace po zakończeniu builda
}
}
}