title: Dockerfile build from parent directory
body: <p>I have a python application which uses celery workers which I would like to dockerise. Unfortunately, both python and Celery are using the same code base. Although they have to be separate containers for easier scaling. If I build them separately and run the containers it works fine. The problem starts when I introduce docker-compose, therefore I can't swap the dockerfiles out in the code folder and the containers need to be built from outside of the folder. The folder structure is the following:</p>
  
  <pre><code>/application
      /application-build
         Dockerfile
      /celery-build
         Dockerfile
      /code
         application.py
         otherfiles.py
  </code></pre>
  
  <p>I have been digging around for a bit now and unfortunately, as far as I know files from the parent directory can't be copied in the dockerfile. Although I would like to copy the same code into both of the containers. 
  <em>(Mind that the following dockerfiles are not the exact ones I use.)</em></p>
  
  <p>Dockerfile1:</p>
  
  <pre><code>FROM python:3.6
  ADD /code .
  COPY requirements.txt requirements.txt
  RUN python3.6 -m pip install -r requirements.txt
  CMD ["python3.6", "application.py"]
  </code></pre>
  
  <p>Dockerfile2:</p>
  
  <pre><code>FROM python:3.6
  ADD /code .
  COPY /code/requirements.txt .
  RUN python3.6 -m pip install -r requirements.txt
  CMD ["celery","-A application.celery", "worker","work1@host"]
  </code></pre>
  
  <p>One solution I see is to reorganise the folders so the code directory is always the child of the dockerfile's directory like so:</p>
  
  <pre><code>/application
     /application-build
        Dockerfile
        /celery-build
           Dockerfile
           /code
              application.py
              otherfiles.py
  </code></pre>
  
  <p>Although it doesn't look clever at all.</p>