Docker-compose setup: messed up volumes

docker
circle.yml

#1

Here’s the situation:

I have a docker-compose-based project, and 2 workflows in CI, mostly for testing. One workflow for PHP (using circleci/php docker image) and one for NodeJS (using circleci/node docker image).
I wonder whether the circleci images are useful or not, but all I need is docker & docker-compose, because tests should be executed with a docker-compose exec {...} call.

Building the images works well, starting them works too, but the volumes are not set.

The project is open-source so anyone can check it out just in case.

The PHP build doesn’t work because when I look inside the container (via docker-compose exec php ls -lah), the project directory contains only 2 things: the var/ directory and the package.json file. But it should contain the whole project.

Any idea on why the volume is not mounted with all files?


#2

Yep, this question comes up about once a fortnight :stuck_out_tongue_closed_eyes:

… I got caught out by this bug too at some point!


#3

So, this basically means that I should change the way I work with compose on CircleCI?

With what I see on this linked issue is that I should build the image with all the source code inside it (with COPY dockerfile rules) and run it?


#4

That is one solution, yes. Since you are doing Docker builds, you don’t need the (larger) CircleCI convenience image - just use a Docker image instead.


#5

I’ve tested using the image directly, but first it doesn’t allow me to use the Makefile I provide for dev & ci because it’s docker-compose based, and second I have permission issues because it seems I can’t share the composer/npm cache to make my builds faster :frowning:


#6

:frowning_face: in sympathy.


#7

@Pierstoval Have you tried running this is the machine executor rather than the docker executor?