I have a working docker-compose.yml
file that sets up a website, database and nodejs. Within a website image I mount a volume in the root of my project in which I will develop my site (theme). In theses sites I regularly use Bower and Gulp to manage libraries and compile my static files like SASS. Because this site is being mounted via the website image I don’t see a way to run my npm, bower and gulp commands inside a other container and not from my host machine (running the npm, bower and gulp command is what I do right now and I would like to shield this off from the host, because running multiple projects with multiple dependencies versions is now a nightmare and I thought Docker would solve this).
What my project file now looks like is
docker-compose.yml
Dockerfile
/my-theme
bower.json
gulpfile.js
package.json
...REST OF THE THEME FILES...
In the Dockerfile I run node,npm install
and all the rest of the necessary Gulp and Bower commands I also run getting it to work on my host machine, but I just don’t get how I can get these commands to run only in the /my-theme
folder which is mounted (volume:
) in the root of my project folder.
Here is a version of my project file hosted on Github https://github.com/mvaneijgen/docker-wordpress-with-gulp I think what I somehow need to do is set the working_dir:
of node:
in my services:
to the folder in the root, but I just can’t get it figured out and would love it if anyone could shine some light on how this should work.