I have a Dockerfile that ends with
ENTRYPOINT ["node", "index.js"]
CMD ["--help"]
The index.js can take a couple different arguments and I also need to expose a port for the container so if I run it manually I do something like:
docker run -p 3000:3000 my_container:latest --arg1 somearg --arg2 anotherarg
How do I do this in a Jenkinsfile? My test will communicate with this container so it needs to be running before I run the test. I use withRun() get it running before the test runs but I don't see how to specify the --arg1 somearg --arg2 anotherarg
stage('TestMicroservice') {
//
// HOW DO I SPECIFY '--arg1 somearg --arg2 anotherarg'?
//
docker.image("my_container:latest").withRun('-p 3000:3000') {
sh 'npm run test-microservice'
}
}