-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
87 lines (86 loc) · 3.01 KB
/
Jenkinsfile
File metadata and controls
87 lines (86 loc) · 3.01 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
pipeline {
agent any
// environment {
// DOCKER_IMAGE = 'docker:latest'
// }
stages {
// stage('Checkout') {
// steps {
// checkout scm
// }
// }
// stage('Install Docker') {
// steps {
// script {
// // Start a Docker container to install Docker (DinD approach)
// def dockerInstallCmd = """
// docker run --rm --privileged --name jenkins-docker \
// -d -p 2375:2375 -v /var/run/docker.sock:/var/run/docker.sock \
// -v /usr/bin/docker:/usr/bin/docker $DOCKER_IMAGE
// """
// sh dockerInstallCmd
// }
// }
// }
// stage('Test Docker') {
// steps {
// script {
// // Test Docker installation
// sh 'docker --version'
// }
// }
// }
stage ('Clone') {
steps {
git 'https://github.com/huynguyen011097/github-python-web-app.git'
}
}
stage ('Build') {
steps {
withDockerRegistry(credentialsId: 'Docker-Hub-Login', url: 'https://index.docker.io/v1/') {
sh 'docker build -t 997909799/pythonwebapp:V1 .'
// sh 'docker push 997909799/pythonwebapp'
}
}
}
}
// post {
// cleanup {
// // Clean up the Docker container used for installing Docker
// script {
// sh 'docker stop jenkins-docker'
// }
// }
// }
}
// pipeline {
// agent none
// stages {
// stage('Prepare Docker Image') {
// steps {
// script {
// // Đảm bảo rằng Docker Daemon đã được kích hoạt
// def dockerImage = docker.image('docker:dind')
// dockerImage.inside('-v /var/run/docker.sock:/var/run/docker.sock') {
// sh 'echo "Docker Daemon is running"'
// }
// }
// }
// }
// stage('Build and Test') {
// agent {
// docker {
// // Chọn hình ảnh Docker mà bạn muốn sử dụng làm agent
// image 'your_custom_docker_image:tag'
// args '-v /var/run/docker.sock:/var/run/docker.sock'
// }
// }
// steps {
// // Thực hiện các bước xây dựng và kiểm tra ứng dụng trong container Docker
// sh 'docker --version'
// sh 'your_build_and_test_commands_here'
// }
// }
// // Add more stages for your deployment or other tasks
// }
// }