ci: implements jenkins deploy
This commit is contained in:
69
Jenkinsfile
vendored
Normal file
69
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
APP_NAME = "pablotj-portfolio-api"
|
||||
REGISTRY_URL = "registry.pablotj.com"
|
||||
NAMESPACE = "andromeda"
|
||||
USER = "andromeda"
|
||||
PASS = credentials('docker-registry-password')
|
||||
TAG = "latest"
|
||||
HOST_PORT = "8080"
|
||||
CONTAINER_PORT = "3000"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Preparar') {
|
||||
steps {
|
||||
echo "Limpiando workspace..."
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
echo "Clonando repo..."
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
echo "Construyendo imagen..."
|
||||
sh "make build"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Tag') {
|
||||
steps {
|
||||
echo "Tagging imagen..."
|
||||
sh "make tag"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Login & Push') {
|
||||
steps {
|
||||
echo "Subiendo imagen al registry..."
|
||||
sh "docker login ${REGISTRY_URL} -u ${USER} -p ${PASS}"
|
||||
sh "make push"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
echo "Deteniendo y levantando contenedor..."
|
||||
sh "make deploy"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo "Despliegue completado correctamente"
|
||||
}
|
||||
failure {
|
||||
echo "Ha fallado el pipeline"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user