Skip to content

Commit 11a967b

Browse files
author
govind
committed
adding jenkinsfile and DockerPipeline.groovy
1 parent 4fcbdcc commit 11a967b

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

DockerPipeline.groovy

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
pipeline {
2+
environment {
3+
DOCKER_REGISTRY_CREDENTIALS = 'docker-registry-credentials'
4+
MONGO_USERNAME = 'ati'
5+
MONGO_PASSWORD = 'ati1234'
6+
}
7+
8+
stages {
9+
stage('Pull Docker Images') {
10+
steps {
11+
script {
12+
docker.image('postgres:latest').pull()
13+
docker.image('redis:latest').pull()
14+
docker.image('mongo:latest').pull()
15+
docker.image('mongo-express:latest').pull()
16+
}
17+
}
18+
}
19+
stage('Run Containers') {
20+
steps {
21+
script {
22+
docker.image('postgres:latest').run('-d --name postgres-container')
23+
docker.image('redis:latest').run('-d --name redis-container')
24+
docker.image('mongo:latest').run("-d --name mongodb-container -e MONGO_INITDB_ROOT_USERNAME=${env.MONGO_USERNAME} -e MONGO_INITDB_ROOT_PASSWORD=${env.MONGO_PASSWORD}")
25+
docker.image('mongo-express:latest').run("-d --name mongo-express-container -e ME_CONFIG_MONGODB_ADMINUSERNAME=${env.MONGO_USERNAME} -e ME_CONFIG_MONGODB_ADMINPASSWORD=${env.MONGO_PASSWORD} --link mongodb-container:mongo")
26+
}
27+
}
28+
}
29+
}
30+
31+
post {
32+
success {
33+
echo 'Containers are running successfully'
34+
}
35+
}
36+
}
37+

Jenkinsfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
pipeline {
2+
agent {
3+
docker {
4+
image 'node:lts-buster-slim'
5+
args '-p 3000:3000'
6+
}
7+
}
8+
environment {
9+
CI = 'true'
10+
}
11+
stages {
12+
stage('Build') {
13+
steps {
14+
sh 'npm install'
15+
}
16+
}
17+
stage('Test') {
18+
steps {
19+
sh './jenkins/scripts/test.sh'
20+
}
21+
}
22+
stage('Deliver') {
23+
steps {
24+
sh './jenkins/scripts/deliver.sh'
25+
input message: 'Finished using the web site? (Click "Proceed" to continue)'
26+
sh './jenkins/scripts/kill.sh'
27+
}
28+
}
29+
}
30+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"react-scripts": "^5.0.1"
99
},
1010
"scripts": {
11-
"start": "react-scripts start",
11+
"start": "PORT=3004 react-scripts start",
1212
"build": "react-scripts build",
1313
"test": "react-scripts test --env=jsdom",
1414
"eject": "react-scripts eject"

0 commit comments

Comments
 (0)