diff --git a/Dockerfile b/Dockerfile index 56c3134..8bd0a7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1 @@ -FROM httpd:2.4 -COPY ./index.html /usr/local/apache2/htdocs/ +FROM nginx diff --git a/Jenkinsfile b/Jenkinsfile index dfa7746..0cbcce6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,42 +1,27 @@ pipeline { - environment { - registry = "192.168.1.81:5000/justme/myweb" - dockerImage = "" - } - - agent any + agent { label 'jenkins-docker-agent' } stages { - stage('Checkout Source') { steps { - git 'https://github.com/justmeandopensource/playjenkins.git' + git url:'https://github.com/ladung/playjenkins.git', branch:'test-deploy-dungla' } } - - stage('Build image') { - steps{ - script { - dockerImage = docker.build registry + ":$BUILD_NUMBER" - } + stage('Docker build') { + steps { + container('docker-dind') { + sh 'docker version' + sh 'docker build -t a:b -f Dockerfile .' } } - - stage('Push Image') { - steps{ - script { - docker.withRegistry( "" ) { - dockerImage.push() - } - } - } - } - +} stage('Deploy App') { steps { + sh 'ls -la' + sh 'java -version' script { - kubernetesDeploy(configs: "myweb.yaml", kubeconfigId: "mykubeconfig") + kubernetesDeploy(configs: "nginx.yaml", kubeconfigId: "kubeconfigdev") } } } diff --git a/Jenkinsfile.bak b/Jenkinsfile.bak new file mode 100644 index 0000000..6f96c68 --- /dev/null +++ b/Jenkinsfile.bak @@ -0,0 +1,27 @@ +podTemplate(containers: [ + containerTemplate(name: 'maven', image: 'maven:3.8.1-jdk-8', command: 'sleep', args: '99d') +]) +pipeline { + + agent { label 'jenkins-agent' } + + stages { + + stage('Checkout Source') { + steps { + git url:'https://github.com/ladung/playjenkins.git', branch:'test-deploy-stage' + } + } + + stage('Deploy App') { + steps { + sh 'ls -la' + script { + kubernetesDeploy(configs: "nginx.yaml", kubeconfigId: "kubeconfigdev") + } + } + } + + } + +} diff --git a/Jenkinsfile.bak2 b/Jenkinsfile.bak2 new file mode 100644 index 0000000..1b88bfb --- /dev/null +++ b/Jenkinsfile.bak2 @@ -0,0 +1,20 @@ +pipeline { + agent { + kubernetes { + //cloud 'kubernetes' + containerTemplate { + name 'maven' + image 'maven:3.8.1-jdk-8' + command 'sleep' + args '99d' + } + } + } + stages { + stage('Run maven') { + steps { + sh 'mvn -version' + } + } +} +} diff --git a/index.html b/index.html deleted file mode 100644 index 05abbe4..0000000 --- a/index.html +++ /dev/null @@ -1,7 +0,0 @@ -
Demo of Jenkins CI/CD Pipeline using BlueOcean and Kubernetes Continuous Deployment plugins
- -