Skip to content

Conversation

@isaac-diez
Copy link

Tasks

  1. Pull Jenkins Docker Image
  2. Build and Run Jenkins Container
docker run -d \
 --name jenkins \
 -p 8080:8080 \
 -p 50000:50000 \
 -v jenkins_home:/var/jenkins_home \
 -v /var/run/docker.sock:/var/run/docker.sock \
 --privileged \
 jenkins/jenkins:lts
  1. Configure Jenkins Account
    image

  2. Install Basic Plugins
    image

  3. Create a Pipeline for Spring Boot Project
    image

pipeline {
    agent any

    tools {
        maven 'M3'
        jdk 'java-21'
    }

    stages {
        stage('Checkout') {
            steps {
                git 'https://github.com/isaac-diez/BooksPageable.git'
            }
        }

        stage('Build') {
            steps {
                sh 'mvn clean package'
            }
        }

        stage('Docker Build') {
            steps {
                script {
                    docker.build("pageablebooks:${env.BUILD_ID}")
                }
            }
        }

        stage('Docker Run') {
            steps {
                script {
                    docker.image("pageablebooks:${env.BUILD_ID}").run('-p 8088:8088')
                }
            }
        }
    }
}

Result:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant