This is an effort to work with Mojo in a devcontainer without Vs Code leveraging Devcontainer CLI , this particular set up is geared towards usage with Neovim, you can customize it to fit your own needs.
The major reason Dev Container is really needed here is because it proves a nice interface to mount local neovim configuration and state into the container - See .devcontainer/devcontainer.json.
- Devcontainer cli
- Docker
You can either get started by using this repository as a template, cloning it, or just copying the files you want. For simplicity I'll assume you've cloned to repository. In this case, getting started is pretty easy:
make setup
To configure Max SDK in docker and initialize devcontainer
make
To launch a Neovim instance inside the devcontainer workspace.
The Dockerfile in root folder sets up Neovim and Magic. This needs to be built once and the image referenced inside .devcontainer/Dockerfile
. The idea is that all subsequent projects would use the built image as a base
layer so we wouldn't need to go through the entire setup every time we want to start a new project.
make sdk
Or
docker build . -t max-sdk
In my local machine I moved this Dockerfile to a new ~/modular directory, I recommend you do the same.
You can start devcontainer:
devcontainer up --workspace-folder .
or (on Mac or Linux)
make devcontainer
Run mojo:
devcontainer exec --workspace-folder . magic run mojo
to start Neovim inside the container and open it simply do:
make launch
alias
make
Then you probably don't need devcontainer. Remove every Neovim setup command in Dockerfile. You can then build directly build and run .devcontainer/Dockerfile (after you've built the sdk dockerfile of course.)
cd .devcontainer
docker build . -t mojo-standalone
docker run -it mojo-standalone magic shell
Devcontainer makes using this thing for a serious project a better experience, I recommend you keep it.