-
Notifications
You must be signed in to change notification settings - Fork 0
Description
🤷♂️ Why
A Devcontainer implies that your IDE is utilizing a container for your terminal and all your automations. This is nice because a container is lightweight construct, that can be build from code. Consequently all team mates always work in the exact same environment, based off a declarative version controlled recipe stored in the repository.
A Devcontainer is a JSONflavour added to the container image during build. It's designed to make life easier for software developers.
Caution
The image you choose as your foundation may limit what you can do and where it can run.
Tip
In GitHub context a safe bet is to go with ubuntu-latest. This runner is the fastest one to launch in Workflows (not because it's slim, but because GitHub favors it). And for that same reason it's also the only container that is supported in copilot-setup-steps.yml1
The Ubuntu noble (nick name for 24-04) from the VS Code context matches ubuntu-latest in GitHub workflow context2.
And it is compliant with both MacOS, Windows and Linus and both ARM64 and AMD64
💬 Prompt
Create a devcontainer in the default location '.devcontainers/devcontainer.json'.
The image should be Ubuntu:noble and add the additional features 'GitHub CLI',
'Common Utilities', Python' and 'Go'
🛠️ D.I.Y.
- From the Command Palette3 in VS Code
Dev Containers:Add Dev Container Configurations Files...
- Add configuration to workspace
- Ubuntu
- noble
- Select additional features to install
- GitHub CLI ('devcontainers')
- Common Utilities ('devcontainers')
- Python ('devcontainers')
- Go ('devcontainers')
- Keep Defaults
- Include
.github/dependabot
- Ubuntu
The steps above will create .devcontainer/devcontainer.json
- Reopen in container
Command Palette
Dev Containers:Reopen in Container
- Test:
Open a terminal and run
lsb_release -aIt should show the detailed distribution information (release, codename, etc.)
##🤖 Automate
.scripts/co-sample "Add a Dev Container" \
batch1 \
.devcontainer/devcontainer.json \
.github/dependabot.yml💣 Not so lucky?
Hmm your PC may not have Docker setup correctly (next step...)