Use of VS Code's Development Container #342
astroesteban
started this conversation in
Show and tell
Replies: 1 comment
-
Update
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
About
Hey y'all. I've been using Visual Studio Code's development container feature for some of my work and personal projects and I went ahead and set it up for cFS. It's nothing out of this world but it's an incredibly useful tool for just quickly cloning cFS in VS Code and having it reopen in a Docker container that contains everything you need to get started.
Check it out here: https://github.com/astroesteban/cFS/tree/feature/add-devcontainer
You can find out more info about devcontainers here.
Here is a great YouTube playlist from Microsoft on development containers: https://youtu.be/61M2takIKl8
Basically they allow you to use a Docker container as your development environment. VS Code automatically recognizes the
.devcontainer
folder and mounts your project into the container in the background. It's great for newbies to get setup and running as well as creating a common development environment for everyone.I usually just create the .devcontainer folder with the devcontainer.json and Dockerfile inside of it but with this approach I decided to base it on a docker-compose.yml file so that you can have the same environment if you choose not to use VS Code and also be able to easily extend and modify the services.
The one drawback is that Docker containers do not have any "straightforward" support for GUI's so in the long term integration with a web-based framework like OpenMCT or COSMOS web version will be the way to go.
New Files
Setup VS Code
In order to use dev containers you will need:
Install Docker and Visual Studio Code then in VS Code install the Remote Development Extension Pack. The extension pack will allow you to develop using SSH or, for our purpose, a dev container.
Next, you'll need to copy the two folders and the docker-compose.yml to your cFS fork and open the repo in VS Code.
Once you have the repo opened in VS Code you should see a pop-up in the bottom right:

If you don't see that you can click on the magenta icon in the bottom left:

and then click on "Reopen in Container"

VS Code will build and start the container. Then it will mount your repo as a cached volume inside of the container so any changes made in the devcontainer are to your host repo.
You should end up with something that looks like this:

Setup Standalone
You can also use the docker-compose.yml file to just start a standalone container that you can ssh into or attach to.
This is still a work in progress so I will be updating the
feature/add-devcontainer
branch as I go through the cFS tutorials to make sure newcomers have a fully-fledged dev environment that's ready to go.Beta Was this translation helpful? Give feedback.
All reactions