jenkins init

This commit is contained in:
l.gabrysiak 2024-08-21 16:11:58 +02:00
parent 9d939e2f2c
commit 6c30c84067
1 changed files with 43 additions and 0 deletions

43
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,43 @@
pipeline {
agent any
environment {
DOCKER_IMAGE = 'docker.cloud.pokash.pl/szkolenia.riskoff.pl'
DOCKER_REGISTRY = '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 {
docker.build("${DOCKER_IMAGE}:latest")
}
}
}
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() // Czyści workspace po zakończeniu builda
}
}
}