I have a Node.js application with a Docker file. I want to build this in Jenkins. I also want to run test cases.For which I have defined a script in package.json
file. Which runs test cases and generates coverage report.
From what I have understood. I need to
- Run Jenkins in Docker
- Checkout branch
- Create a Docker in Jenkins
- Build my application
- Run test cases and generate coverage reports
- Deploy
I want to checkout my repository from github.com . Here are the steps that I followed
- Click on new item on Jenkins main page
- Entered name and chose pipeline form list
- Under Pipeline I chose definition as Pipeline script from SCM
- Chose SCM as GIT
- Under Repository entered the Repository Url with the credentials
- Under Branches to build entered by branch as */my_branch_here
- Added the script path for Jenkins file
Here is what my Jenkins file looks like
pipeline {
agent {
docker {
image 'node:6-alpine'
args '-p 3000:3000'
}
}
stages {
stage('initialization') {
steps {
script {
TAG_NAME = '1.1.'+ "${env.BUILD_NUMBER}"
def clientImage = docker.build("registrypath:5000/test:${TAG_NAME}", "-f ./path_to_dockerfile/Dockerfile .")
}
}
}
}
}
I get a Docker error: command not found. I have not been able to complete the first step to proceed further.