An anecdote of how I have used Entrypoint vs CMD. When running the unit tests in a Jenkins pipeline I initiate the runner stage. When I run the e2e tests I want to make sure the system is executing the e2e yarn with sane defaults, so we execute an ENTRYPOINT where we can easily override the params (it also makes the command shorter in the Jenkinsfile).
#######################################################################################################################
#
# Stage: Runner
# Purpose: Runs any NPM scripts using Yarn. Defaults to running unit tests.
#
#######################################################################################################################
FROM installer AS runner
CMD [ "yarn", "test", "--coverage" ]
#######################################################################################################################
#
# Stage: E2E Runner
# Purpose: Runs end-to-end tests. This stage will use BrowserStack if the proper environment variables are provided.
#
#######################################################################################################################
FROM builder AS e2e-runner
ENTRYPOINT [ "yarn", "test:e2e" ]
CMD [ "--env", "chromeHeadless", "--timeout", "60000", "--tags", "@criticalPath" ]
An anecdote of how I have used Entrypoint vs CMD. When running the unit tests in a Jenkins pipeline I initiate the runner stage. When I run the e2e tests I want to make sure the system is executing the e2e yarn with sane defaults, so we execute an ENTRYPOINT where we can easily override the params (it also makes the command shorter in the Jenkinsfile).
Neat 👍