Files
otomai/Jenkinsfile
2025-02-22 20:50:12 +02:00

69 lines
2.2 KiB
Groovy

pipeline {
agent {
label 'docker'
}
stages {
stage("Clean workspace") {
steps {
script {
sh "ls"
deleteDir()
sh "ls"
}
}
}
stage('Checkout SCM') {
steps {
git branch: 'main', url: 'https://git.ruff.co.il/amai.ig/otomai.git'
}
}
stage('Download Latest release') {
steps {
sh 'curl -LO https://git.ruff.co.il/amai.ig/otomai/releases/download/latest/Otomai-web.zip'
}
}
stage('Create web game directory') {
steps {
sh 'mkdir ./game-data'
}
}
stage('Unzip File') {
steps {
sh 'unzip -d game-data/ Otomai-web.zip'
}
}
stage('Build Docker Image') {
steps {
dir('./') {
script {
// Define image name and registry details
def imageNameId = "git.ruff.co.il/amai.ig/otomai:1.${env.BUILD_ID}"
def imageNameLatest = "git.ruff.co.il/amai.ig/otomai:latest"
def registryCredentialsId = '7e506860-ca64-47bd-92a8-1a591dd12cba'
// Login to the Docker registry with credentials
docker.withRegistry('https://git.ruff.co.il', registryCredentialsId) {
// Build and push images using docker.build()
def customImageId = docker.build(imageNameId)
def customImageLatest = docker.build(imageNameLatest)
// Push image to registry
customImageId.push()
customImageLatest.push()
}
}
}
}
}
}
post {
success {
// Trigger the deployment job on success of the build
build job: 'otomai-prod', wait: false
}
failure {
echo "Build failed, deployment not triggered."
}
}
}