- Benefits of Development Containers
- Adding a Development Container to a Project
- What are Features?
- Ministry of Justice Features
- Creating a New Feature
- Adding Features to a Development Container
- Contributing
This repository was created by Ministry of Justice's Dev Container Community of Practice. The goal is to release a foundational image for deployment, develop features that boost developer efficiency, and set a benchmark for using containerised development environments within the Ministry of Justice. Additionally this repository serves documentation relating to the use and configuration of devcontainers within the Ministry of Justice.
Contact us on our Slack channel - #devcontainer-community
.
Official documentation is located here.
-
Consistency Across Environments - Ensures that every developer in a team/project/product works with the same tools and configurations, reducing compatibility issues.
-
Isolation from Local Machine - Keeps project-specific settings and dependencies separate from the local environment, avoiding conflicts.
-
Simplified Onboarding - Allows new developers to quickly set up a pre-configured development environment, speeding up the onboarding process.
-
Reproducibility - Enhances the reliability of builds and tests across different environments by maintaining consistent settings.
-
Tool Integration - Offers seamless integration with development tools for efficient coding, debugging, and execution within the container.
-
Portability - Enables developers to move their development environments across machines and platforms easily without reconfiguration.
-
Ease of Updates - Facilitates straightforward updates and dependency management by allowing updates to be propagated through container images.
-
GitHub Codespaces Integration - Enables developers to access fully configured development environments in the cloud via GitHub Codespaces, enhancing flexibility and accessibility.
- Create a
.devcontainer
folder in the root of your project. - Add a
devcontainer.json
file to the.devcontainer
folder. There are a number of parameters which can be included in a devconatiner.json file, these are noted in detail here. - Populate the
devcontainer.json
file with the required settings:
{
"name": "devcontainer-example",
"image": "ghcr.io/ministryofjustice/devcontainer-base:latest"
}
In the example above, the name
parameter specifies the name of the development container, and the image
parameter specifies the base image for the development container.
The ghcr.io/ministryofjustice/devcontainer-base
image is an extension of mcr.microsoft.com/devcontainers/base:ubuntu-24.04
. The enhancements are documented here.
In the context of the Ministry of Justice Development Container community, features are built by the community to satisfy the specific needs of our developers and the challenges they face on a day to day basis.
Features created in the Dev Container community are described here both can be consumed when constructing a Development Container. From this point on, we will refer to these features as "Community Features" and Ministry of Justice feature as "Features".
Features are built using the .devcontainer GitHub repository and are designed to be modular and reusable. This means that features can be combined to create a custom development environment that meets the needs of a specific project or team.
Features are can be used by Sofware Developers and those in Operations Roles to create consistent and reliable development environments for the applications and services they work on.
Features are located in the features folder in the Development Container GitHub repository. Each feature is listed below.
The AWS feature installs the AWS CLI and AWS SSO CLI .
The Cloud Platform feature installs the Cloud Platform CLI.
The Container Structure Tests feature installs the container-structure-test CLI, this tool provides a powerful framework to validate the structure of a container image.
The Kubernetes feature installs:
-
kubectl - to interact with Kubernetes clusters
-
helm - the package manager for Kubernetes
-
ct - to lint and test Helm charts
The Static Analysis feature installs:
The Terraform feature installs the terraform
CLI.
To add a new feature:
- Clone the
.devcontainer
repository. - Create a new feature in the .devcontainer GitHub repository.
- Add the feature to the Development Container Features documentation.
- Add tests for the feature in the .devcontainer GitHub repository.
To consume a feature, add the feature to the features
array in the devcontainer.json
file. An example of this is shown below:
{
"name": "devcontainer-example",
"image": "ghcr.io/ministryofjustice/devcontainer-base:latest",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/ministryofjustice/devcontainer-feature/container-structure-test:0": {},
"ghcr.io/ministryofjustice/devcontainer-feature/static-analysis:0": {}
}
}
In the example above, the features
array includes the docker-in-docker
, container-structure-test
, and static-analysis
features. Note that the docker-in-docker
feature is a community feature, while the other two features are Ministry of Justice features. Both types of features can be consumed in the same way.
The base branch requires all commits to be signed. Learn more about signing commits here.