6

I am wondering how to specify which step to not cache within the Dockerfile?

In this example, I want to cache npm install but I do not want to cache newman run. Can I do this within this Dockerfile?

FROM postman/newman
RUN npm install -g newman-reporter-teamcity
COPY . /etc/newman

# Do not cache
RUN newman run collections.json -x --delay-request 10 -r teamcity
Jon
  • 8,205
  • 25
  • 87
  • 146
  • Does this answer your question? [Disable cache for specific RUN commands](https://stackoverflow.com/questions/35134713/disable-cache-for-specific-run-commands) – John Kugelman Nov 07 '19 at 23:36
  • @JohnKugelmansupportsMonica - I saw that post but it isn't what I'm looking for. The responses revolve around either passing in a random argument to invalidate the cache (which from my understanding will not solve my issue), or to break the Dockerfile up into several files (which I am trying to keep in one piece). – Jon Nov 07 '19 at 23:42
  • 2
    Why won't the random argument solve your issue? – John Kugelman Nov 07 '19 at 23:45
  • There's also this question, with the same answers: [rebuild docker image from specific step](https://stackoverflow.com/q/35154219/596285) – BMitch Nov 08 '19 at 00:06
  • 1
    That seems like you want it to be the `CMD` of the image and not something you `RUN` at build time. (I'd be surprised if you wanted the test results permanently embedded in the image.) – David Maze Nov 08 '19 at 11:13

0 Answers0