re: A Linux Dev Environment on Windows with WSL, Docker, tmux and VSCode VIEW POST

FULL DISCUSSION
 

Could you go more in-depth on integrating Docker into the workflow? From what I understand, from looking at other tutorials, you need a 'volumes' section in the docker-compose file that looks at your code, with separate folders that aren't watched for dependencies, such as node-modules, venv if you're using that, etc?

 

For development I almost always volume mount .:/app which would mount in the current directory (the source code) into the /app path in the container which is a general place I use to keep my source code in the container, but in your case the /app part might vary.

I don't worry about node_modules/ because at Docker build time I configure yarn to install its dependencies into /node_modules inside the Docker image instead of node_modules/ which is relative to /app.

You can do that with a .yarnrc file by putting in --modules-folder /node_modules.

In other words, I don't end up with 42 billion node dependencies on my dev box through the volume because they're never mounted.

The same strategy applies with other language package managers that install dependencies to relative folders by default (such as Composer with PHP and Mix with Elixir).

code of conduct - report abuse