I am trying to set up a modular development environment with docker containers, In which:
1) no sdks/dev tools/compilers getting installed in my host machine (those should live inside the specific containers only)
2) Using my text editors (Vim, Spacemacs) in their GUI version on OSX
The main problem here is that most of the time the text editors specific language plugins (like elm layer in Spacemacs) needs those tools in order to work correctly.
Any help?
At the end what worked for me was setting global alias.sh file sourcing it in my .bash_profile with the following commands:
grep -q -F 'source ~/.docker-shared/alias.sh' ~/.bash_profile \
|| echo 'source ~/.docker-shared/alias.sh' >> ~/.bash_profile
and
mkdir -p ~/.docker-shared && touch ~/.docker-shared/alias.sh
Then for each development environment I can create alias.sh file containing all commands from the container using docker-compose:
alias elm-repl='docker-compose run web elm-repl'
When my docker-compose.yml contians the following:
version: "2"
services:
web:
build: .
image: web
ports:
- "8000:8000"
volumes:
- .:/app
- ~/.docker-shared:/shared
entrypoint: ""
command: bash -c "mkdir -p /shared && cp /app/alias.sh /shared"
running
docker-compose up web
will setup my environment and aliases. Those aliases will be used in the text editors.
In my case I had to set vimrc and spacemacs to use a interactive shell for that to work, so I added the following lines to my config files:
.vimrc:
set shellcmdflag=-ic
.spacemacs:
(setq shell-command-switch "-ic")
Here's my elm dev environment