Can't find the Rakefile in a docker-compose environment

In the end I needed to run Circle in machine mode instead of docker mode.

The problem was that docker mode doesn’t allow for volume mounting, which clashed with the way this project is configured (the docker images web and postgres share volumes with its orchestrator).

This is my final config.yml file:

jobs:
  build:
    machine: 
      enabled: true
      image: circleci/classic:latest
    
    working_directory: ~/project

    steps:
      - checkout

      - run:
          name: Build service
          command: docker-compose build

      - run:
          name: Put the backend up and down in preparation for the migrations
          command: |
            docker-compose up -d
            docker-compose down

      - run:
          name: Run the Rakefile
          command: |
            docker-compose run web rake db:create db:migrate

      - run:
          name: Put the backend up again
          command: docker-compose up -d

      - run:
          name: Run the test suite
          command: |
            docker-compose exec web bundle exec rspec