diff --git a/Jenkinsfile b/Jenkinsfile index e25a966..4e13933 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 } } }