pl-1/Jenkinsfile

49 lines
1.4 KiB
Text
Raw Normal View History

2025-10-06 11:40:37 -03:00
pipeline {
agent any
environment {
2025-10-06 17:20:24 -03:00
IMAGE_NAME = 'rd.jenkins'
AWS_USER = 'liesa'
AWS_REPO = "${AWS_USER}/${IMAGE_NAME}"
AWS_URL = '231670719202.dkr.ecr.sa-east-1.amazonaws.com'
TAG = 'latest'
2025-10-06 11:40:37 -03:00
}
stages {
2025-10-06 17:20:24 -03:00
stage('Checkout (with submodules)') {
steps {
checkout(scmGit(
branches: [[name: '*/main']],
userRemoteConfigs: [[
url: 'https://stalked-noegenetic-amari.ngrok-free.dev/hermes/pl-1.git',
credentialsId: 'hermes-forgejo-local'
]]
))
}
}
2025-10-06 11:40:37 -03:00
stage('Build Image') {
steps {
script {
2025-10-06 17:20:24 -03:00
docker.build("${AWS_REPO}:${TAG}", '-f Dockerfile .')
2025-10-06 11:40:37 -03:00
}
}
}
stage('Push Image') {
steps {
2025-10-06 17:20:24 -03:00
sh '''
set -eu pipefail
aws ecr get-login-password --region sa-east-1 | docker login --username AWS --password-stdin $AWS_URL
'''
2025-10-06 11:40:37 -03:00
script {
2025-10-06 17:20:24 -03:00
docker.withRegistry("http://${AWS_URL}", 'ecr:sa-east-1:aws-prod') {
docker.image("${AWS_REPO}:${TAG}").push()
2025-10-06 11:40:37 -03:00
}
}
}
}
}
}