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
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:4-alpine



WORKDIR /opt/frontend

COPY . .

RUN npm install

EXPOSE 8079

CMD npm start

64 changes: 64 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline {
agent none
stages {
stage('build') {
agent {
docker {
image 'schoolofdevops/node:4-alpine'
}

}
steps {
echo 'this is the build job'
sh 'npm install'
}
}

stage('test') {
agent {
docker {
image 'schoolofdevops/node:4-alpine'
}

}
steps {
echo 'this is the test job'
sh '''npm install
npm test'''
}
}

stage('package') {
agent {
docker {
image 'schoolofdevops/node:4-alpine'
}

}
steps {
sh '''npm install
npm run package'''
archiveArtifacts '**/distribution/*.zip'
}
}

stage('docker build and package') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
def dockerImage = docker.build("prat91/frontend:v${env.BUILD_ID}", "./")
dockerImage.push()
dockerImage.push("latest")
}
}

}
}

}
post {
always {
echo 'this pipeline has completed...'
}

}
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.6"

services:
frontend:
build: .
image: prat91/frontend:v1
ports:
- 8079