title: How to set custom context for docker.build in jenkinsfile
body: <p>I'm trying to adapt a docker build for jenkins.  I'm following our docker-compose file and I'm creating a Jenkinsfile that is creating each container and linking them together.  The problem I'm running into is that the docker-compose files declare a context that is not where the Dockerfile is.  As far as I understand, jenkins will set the context to where the Dockerfile is, which puts files to be copied in a different relative location depending on whether the jenkinsfile or docker-compose file is building.</p>
  
  <p>The folder structure is:</p>
  
  <pre><code>workspace
      |-docker
          |-db
             |-Dockerfile
             |-entrypoint.sh
  </code></pre>
  
  <p>This is how the Dockerfile declares the COPY instruction for the file in question</p>
  
  <pre><code>COPY docker/db/entrypoint.sh /
  </code></pre>
  
  <p>This is how my jenkinsfile builds the file.  Which to my knowledge puts the context at that directory</p>
  
  <pre><code>docker.build("db", "${WORKSPACE}/docker/db")
  </code></pre>
  
  <p>the docker-compose file declares it like:</p>
  
  <pre><code>db:
  build:
    context: .
    dockerfile: docker/db/Dockerfile
  </code></pre>
  
  <p>which puts the context at the root of the project.</p>
  
  <p>Is there any way to tell a jenkinsfile to use the same context as the docker-compose file so that the Dockerfile's COPY instruction can remain unchanged and valid for both Jenkins and docker-compose?  If that's not possible, does anyone know of any alternative solutions?</p>