Search code examples
curldockeropenshiftdockerfileopenshift-origin

OpenShift 3.1 - Prevent Docker from caching curl resource


I have this curl command in my Dockerfile:

RUN curl -H 'Cache-Control: no-cache' -f ${NEXUS_URL}${ARTIFACT_PATH}-${ARTIFACT_VERSION}.war?nocache=true -o $JBOSS_HOME/standalone/deployments/ROOT.war

The first time I ran it I could see the download information. However after that it seems to be caching the remote resource and thus, not updating it anymore:

Step 6 : RUN curl -H 'Cache-Control: no-cache' -f ${NEXUS_URL}${ARTIFACT_PATH}-${ARTIFACT_VERSION}.war?nocache=true -o $JBOSS_HOME/standalone/deployments/ROOT.war
30   ---> Using cache
31   ---> be50412bf6c3

How could I prevent this?


Solution

  • According to the OpenShift docs (https://docs.openshift.com/enterprise/3.1/dev_guide/builds.html#no-cache) you can force builds to not be cached using the following syntax:

    strategy:
      type: "Docker"
      dockerStrategy:
        noCache: true
    

    This will mean that no steps are cached, which will make your builds slower but will mean you have the correct artifact version in your build.