Skip to content

Text1 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
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: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
FROM tomcat:latest
FROM node:10

LABEL maintainer="Nidhi Gupta"
# Create app directory
WORKDIR /usr/src/app

ADD ./target/LoginWebApp-1.war /usr/local/tomcat/webapps/
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

EXPOSE 8080
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

CMD ["catalina.sh", "run"]
# Bundle app source
COPY . .

EXPOSE 80
CMD [ "node", "index.js" ]
73 changes: 14 additions & 59 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,17 @@
pipeline {
agent any

tools
{
maven "Maven"
agent any
stages {
stage('build') {
steps {
echo 'Building a docker image'
sh './scripts/build'
}
}
stages {
stage('checkout') {
steps {

git branch: 'master', url: 'https://github.com/devops4solutions/CI-CD-using-Docker.git'

}
}
stage('Execute Maven') {
steps {

sh 'mvn package'
}
}


stage('Docker Build and Tag') {
steps {

sh 'docker build -t samplewebapp:latest .'
sh 'docker tag samplewebapp nikhilnidhi/samplewebapp:latest'
//sh 'docker tag samplewebapp nikhilnidhi/samplewebapp:$BUILD_NUMBER'

}
}

stage('Publish image to Docker Hub') {

steps {
withDockerRegistry([ credentialsId: "dockerHub", url: "" ]) {
sh 'docker push nikhilnidhi/samplewebapp:latest'
// sh 'docker push nikhilnidhi/samplewebapp:$BUILD_NUMBER'
}

}
}

stage('Run Docker container on Jenkins Agent') {

steps
{
sh "docker run -d -p 8003:8080 nikhilnidhi/samplewebapp"

}
}
stage('Run Docker container on remote hosts') {

steps {
sh "docker -H ssh://[email protected] run -d -p 8003:8080 nikhilnidhi/samplewebapp"

}
}
stage('deploy') {
steps {
echo 'Deployment is in progress'
sh './scripts/deploy'
}
}
}
}
}
26 changes: 26 additions & 0 deletions ci-cd-using-docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"family": "ci-cd-using-docker",
"taskRoleArn": "arn:aws:iam::740075994284:role/task_role",
"Taskexecutionrole": "ecsTaskExecutionRole",
"containerDefinitions": [
{
"name": "ci-cd-using-docker",
"image": "740075994284.dkr.ecr.ap-south-1.amazonaws.com/ci-cd-using-docker:GIT_COMMIT",
"cpu": 300,
"memory": 300,
"memoryReservation": 200,
"volumesFrom": [],
"portMappings": [
{
"hostPort": 0,
"containerPort": 80,
"protocol": "tcp"
}
],
"environment": [],
"mountPoints": []
}
]
}


40 changes: 0 additions & 40 deletions docker-compose.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docker-compose_mysql.yml

This file was deleted.

22 changes: 0 additions & 22 deletions docker-compose_mysql_phpMyAdmin.yml

This file was deleted.

8 changes: 0 additions & 8 deletions docker-compose_tomcat.yml

This file was deleted.

1 change: 0 additions & 1 deletion index.html

This file was deleted.

10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var express = require('express');
var app = express();
app.get('/will', function (req, res) {
res.send('{ "response": "Hello World" }');
});
app.get('/ready', function (req, res) {
res.send('{ "response": "It works!" }');
});
app.listen(process.env.PORT || 3000);
module.exports = app;
41 changes: 0 additions & 41 deletions mysql-dump/USER.sql

This file was deleted.

Loading