Devcontainer ¶
Configuration
- Main config file:
devcontainer.json - Dependencies:
requirements.txt - Dockerfile:
Dockerfile - Service definition:
compose.yml - Finalization:
postAttach.sh
Introduction ¶
VS Code can be used together with Docker via the Remote - Containers extension to enable a container-based development environment.
As a remote-first, cross-platform development team, Compiler uses devcontainers to ease the onboarding and local development process for our engineering team, and to ensure our Open Source projects are widely accessible and easily reproducable for others.
The image ¶
The devcontainer’s image is called compilerla/template-devcontainer.
Base ¶
The image is based on python:3.11, to ease installation of common tooling like
mkdocs and pre-commit.
Setup ¶
Most setup is performed as the non-root $USER, with a default of compiler.
A home directory is created at /home/$USER and the working directory is set to /home/$USER/src.
Additional command-line tools included in the image:
curlgitpipwget
See the official python image on DockerHub for more.
Requirements ¶
The .devcontainer/requirements.txt file lists PyPI packages installed by default into the devcontainer.
Extensions ¶
The devcontainer/devcontainer.json file lists VS Code extensions installed with the devcontainer. These include:
- GitLens for supercharing the
gitexperience - Git Graph for visualizing the
gitcommit history - markdownlint for Markdown linting and style checking directly in VS Code
- Mermaid Markdown Syntax Highlighting for editing Mermaid diagrams in documentation
- Prettier for good default formatting and linting of most file types