Jenkins pipeline running docker

pipeline {
agent { label 'server_61' }

stages {
stage('Checkout') {
steps {
checkout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: '[email protected]:github.git/']])
}
}

stage('Down Docker') {
steps {
script {
sh 'docker-compose down'
}
}
}

stage('Remove Image') {
steps {
script {
// Check if the Docker image exists and remove it if it does
sh 'docker image ls dashboardpkt_app:latest | grep dashboardpkt_app && docker image rm dockrimg:latest || echo "Image not found, skipping removal"'
}
}
}

stage('Remove Volume') {
steps {
script {
// Check if the Docker volume exists and remove it if it does
sh 'docker volume ls | grep dashboardpkt_build-app && docker volume rm dockervolume || echo "Volume not found, skipping removal"'
}
}
}

stage('Build and Run Docker Compose') {
steps {
script {
sh 'docker-compose up --build -d'
}
}
}
}
}

Tambahan tips kalau jekins tidak bisa jalan karena masalah ssl error

jalankan command ini di vm jenkins

ssh-keyscan github.com >> ~/.ssh/known_hosts

Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Related Posts

nginx-error-log

Howto resolve nginx proxy manager failed to renew ssl

  I’ve been using Nginx Proxy Manager for a couple of years now. It provides free SSL with Let’s Encrypt, is designed with security in mind, and…

neuralink brain chip

Neuralink: Revolutionizing Human-Computer Interaction with Brain-Computer Interfaces

What is Neuralink? Neuralink is a revolutionary technology developed by Elon Musk and his team of neuroscientists and engineers. The primary goal of Neuralink is to create…

vector storage

Advantages of Vector Storage for LLMs and AI

In the rapidly evolving landscape of artificial intelligence (AI) and machine learning (ML), one technology stands out as a game-changer: vector storage. This specialized form of data…

GRIT

Implementing GRIT in the Workplace: A Step-by-Step Guide

This Article is based on the Book GRIT by Angela Duckworth, The Power of Passion and Perseverance, As employees, we’ve all faced challenges and obstacles that can…

behaviour-experiment

Understanding Behavioral Experiments

Behavioral experiments are practical, low-risk interventions designed to test and implement new behaviors within an organization. They are a strategic approach to driving cultural and operational change…

Can AI Help Your Company Innovate

Can AI Help Your Company Innovate?

As a business leader, you’re constantly looking for ways to innovate and stay ahead of the competition. But with the rapid pace of technological change, it can…

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading