Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
FROM httpd:2.4
COPY ./index.html /usr/local/apache2/htdocs/
FROM nginx
37 changes: 11 additions & 26 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions Jenkinsfile.bak
Original file line number Diff line number Diff line change
@@ -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")
}
}
}

}

}
20 changes: 20 additions & 0 deletions Jenkinsfile.bak2
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
}
7 changes: 0 additions & 7 deletions index.html

This file was deleted.

23 changes: 12 additions & 11 deletions myweb.yaml → nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: myweb
name: myweb
app: web
name: mynginx111
namespace: dungla
spec:
replicas: 1
selector:
matchLabels:
app: myweb
app: web
template:
metadata:
labels:
app: myweb
app: web
spec:
containers:
- image: 192.168.1.81:5000/justme/myweb:1
imagePullPolicy: Always
name: myweb
- image: nginx:$BUILD_NUMBER
name: mynginx

---
apiVersion: v1
kind: Service
metadata:
labels:
app: myweb
name: myweb
app: web
name: mynginx
namespace: dungla
spec:
ports:
- nodePort: 32223
- nodePort: 32224
port: 80
protocol: TCP
targetPort: 80
selector:
app: myweb
app: web
type: NodePort
20 changes: 20 additions & 0 deletions pod2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Pod
metadata:
name: dood
spec:
containers:
- name: docker-cmds
image: docker:1.12.6
command: ['docker', 'run', '-p', '80:80', 'httpd:latest']
resources:
requests:
cpu: 10m
memory: 256Mi
volumeMounts:
- mountPath: /var/run
name: docker-sock
volumes:
- name: docker-sock
hostPath:
path: /var/run