title: Docker-compose builds app and copy's not inteded directory content specified by dockerfile
body: <p>I'm trying to containerize two services an socket service and a django application</p>
  
  <p>My file structure is</p>
  
  <pre><code>\main file {docker-compose file} 
     \ django application {Dockerfile}
     \ socket app {Dockerfile}
  </code></pre>
  
  <p>When I run <code>docker build .</code> it build the image
  then when I run <code>docker-compose build</code>,
  I notice that the socket app and django app are copied to the container instead of only the django application as specified by the Dockerfile.</p>
  
  <p>I get the idea that the Dockerfile is executed in the main directory instead of the django directory?</p>
  
  <p>Here is Dockerfile that is inside the django app application</p>
  
  <pre><code># Pull base image
  FROM python:3
  
  # Set environment varibles
  ENV PYTHONDONTWRITEBYTECODE 1
  ENV PYTHONUNBUFFERED 1
  
  # Set work directory
  WORKDIR /code
  
  # Install dependencies
  COPY requirements.txt /code/
  RUN pip install -r requirements.txt
  
  # Copy project
  COPY . /code/
  
  RUN ls
  </code></pre>
  
  <p>And here is the docker-compose file.
  With the usage of the ls command I tried to figure out what happend and the output is that the applications in the main folder are copied instead of the django application.</p>
  
  <pre><code>version: '3'
    services:
      db:
        image: postgres:10.1-alpine
        volumes:
          - postgres_data:/var/lib/postgresql/data/
      web:
        build: ./django_app
        command: ls /code/
        volumes:
          - .:/code
        ports:
          - 8000:8000
        depends_on:
          - db
  
    volumes:
      postgres_data:
  </code></pre>
  
  <p>is this intended use or am I doing something wrong?</p>