GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DevOpsClassCodes/Jenkinsfile at master · abbadiomer9/DevOpsClassCodes

Expand file tree

/

Jenkinsfile

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
71 lines (64 loc) · 2.12 KB
/

Jenkinsfile

Copy path

File metadata and controls

71 lines (64 loc) · 2.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
pipeline {
agent {
label 'node1'
}
environment {
// Define environment variables
DOCKER_CREDENTIALS_ID = 'dockerhub-credentials'
DOCKER_IMAGE_NAME = 'abbadi998/newapp'
}
stages {
stage('Checkout') {
steps {
// Checkout code from GitHub
git branch: 'master', url: 'https://github.com/abbadiomer9/DevOpsClassCodes.git'
}
}
stage('Build') {
steps {
script {
// Build the code using Maven
sh 'mvn clean'
sh 'mvn clean package -Dmaven.war.plugin.version=3.3.2'
sh 'mvn help:effective-pom'
}
}
}
stage('Build Docker Image') {
steps {
script {
// Build the Docker image
def imageTag = "${DOCKER_IMAGE_NAME}:${env.BUILD_NUMBER}"
sh "docker build -t ${imageTag} ."
}
}
}
stage('Push Docker Image') {
steps {
script {
// Log in to Docker Hub
withDockerRegistry([credentialsId: "${DOCKER_CREDENTIALS_ID}", url: 'https://index.docker.io/v1/']) {
def imageTag = "${DOCKER_IMAGE_NAME}:${env.BUILD_NUMBER}"
// Push the Docker image to Docker Hub
sh "docker push ${imageTag}"
}
}
}
}
stage('Deploy to Kubernetes') {
steps {
script {
// Set the image tag in the deployment file
def imageTag = "${DOCKER_IMAGE_NAME}:${env.BUILD_NUMBER}"
sh "kubectl run newpod24 --image ${imageTag}"
sh "kubectl expose pod newpod24 --port=8080 --target-port=8080 --name=my-service24 --type=NodePort"
}
}
}
}
post {
always {
cleanWs() // Clean workspace after the build
}
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.