Skip to content

Commit

Permalink
Add link to site
Browse files Browse the repository at this point in the history
  • Loading branch information
jslmorrison committed Dec 15, 2024
1 parent 694293e commit c836c94
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
25 changes: 18 additions & 7 deletions content-org/devcontainers.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
:EXPORT_DATE: 2024-12-15
:END:

How to leverage dev containers in VSCode, in a new or existing project, to help maintain consistent development environments and reduce the time and effort required when 'onboarding' to another team or project.
How to leverage dev containers in VS Code, in a new or existing project, to help maintain consistent development environments and reduce the time and effort required when 'onboarding' to another team or project.

#+hugo: more
#+begin_quote
A Dev Container in Visual Studio Code (VS Code) is a tool that allows developers to define and manage development environments using Docker containers. Unlike normal Docker containers, Dev Containers integrate seamlessly with VS Code, providing a consistent, reproducible, and collaborative development experience.
A Dev Container in Visual Studio Code (VS Code) is a tool that allows developers to define and manage development environments using Docker containers. Unlike normal Docker containers, Dev Containers integrate seamlessly with VS Code, providing a consistent, reproducible and collaborative development experience.
#+end_quote

While this article describes the process of getting started with dev containers in VS Code they can also be used with JetBrains editors/IDE's.
Expand All @@ -21,24 +21,27 @@ While this article describes the process of getting started with dev containers
Before setting up a dev container, ensure you have the following installed:

1. Docker:

Install Docker Desktop (Windows/macOS) or Docker Engine (Linux).
2. Visual Studio Code:

Download and install VS Code from https://code.visualstudio.com/.
3. Dev Containers Extension:

Install the 'Dev Containers' extension from the VS Code Extensions Marketplace.
4. Create new or open existing project
5. Open the Command Palette in VS Code =(Ctrl+Shift+P or Cmd+Shift+P)= and search for =Dev Containers: Add Development Container Configuration Files=.
6. Choose a Predefined Template:

VS Code provides templates for popular development stacks (e.g., PHP, Python, Java). Select the template that best suits your project.

Alternatively just create the file manually.

At this point you will have a =.devcontainer= folder in your project directory which will contain the following:

- =devcontainer.json=: The main configuration file that defines the container’s settings.
- =Dockerfile= (optional): for custom container configurations.

You can now modify the =devcontainer.json= to include any tools, extensions, or configurations you or your team requires. For example:
You can now modify the =devcontainer.json= to include any tools, extensions, or configurations you or your team requires. For example:
#+begin_src json
{
"name": "A PHP/MariaDB container",
Expand All @@ -60,7 +63,6 @@ At this point you will have a =.devcontainer= folder in your project directory w
You don't have to manually define the extensions - just use VS Code as normal by searching for extensions and right clicking them to install in =devcontainer=.

*N.B.* If you are using a =compose= file to orchestrate multiple services:

- Define all services in a docker =compose.yaml= file.
- Update the =devcontainer.json= to specify the service used for the development environment, for example:
#+begin_src json
Expand All @@ -77,16 +79,25 @@ When you have finished editing the =devcontainer.json= file you can reopen the p
** Advantages
In summary, the advantages of using dev containers are:
- Consistency:

Every team member works with the same tools, dependencies and configurations, eliminating the 'works on my machine' problem.
- Simplified onboarding:

New developers can start contributing quickly by simply cloning the repository and opening it in a Dev Container. All necessary dependencies and tools are pre-configured.
- Isolation:

Dev Containers prevent environment conflicts by isolating dependencies from the host machine.
- Integrated Workflow:

Unlike standalone Docker containers, Dev Containers integrate tightly with VS Code, enabling features like IntelliSense, debugging and version control within the container.
- Reproducibility:
The configuration files ensure that the same environment can be reproduced anywhere, whether locally or in CI/CD pipelines.

The configuration files ensure that the same environment can be reproduced
anywhere, whether locally or in CI/CD pipelines.
- Customizability:

Dev Containers can be tailored to include specific extensions, tools, or even custom runtime environments, making them flexible for diverse projects.

Therefore, by leveraging dev containers, development teams can streamline collaboration, maintain consistent environments, and boost productivity. They bridge the gap between containerised workflows and developer friendly tools, making them an excellent choice for modern development practices.
Therefore, by leveraging dev containers, development teams can streamline collaboration, maintain consistent environments and boost productivity. They bridge the gap between containerised workflows and developer friendly tools, making them an excellent choice for modern development practices.

For more info, read the docs [[https://containers.dev/][here]].
25 changes: 18 additions & 7 deletions content/posts/devcontainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ tags = ["docker", "containers", "vscode"]
draft = false
+++

How to leverage dev containers in VSCode, in a new or existing project, to help maintain consistent development environments and reduce the time and effort required when 'onboarding' to another team or project.
How to leverage dev containers in VS Code, in a new or existing project, to help maintain consistent development environments and reduce the time and effort required when 'onboarding' to another team or project.

<!--more-->

> A Dev Container in Visual Studio Code (VS Code) is a tool that allows developers to define and manage development environments using Docker containers. Unlike normal Docker containers, Dev Containers integrate seamlessly with VS Code, providing a consistent, reproducible, and collaborative development experience.
> A Dev Container in Visual Studio Code (VS Code) is a tool that allows developers to define and manage development environments using Docker containers. Unlike normal Docker containers, Dev Containers integrate seamlessly with VS Code, providing a consistent, reproducible and collaborative development experience.
While this article describes the process of getting started with dev containers in VS Code they can also be used with JetBrains editors/IDE's.

Expand All @@ -19,14 +19,18 @@ While this article describes the process of getting started with dev containers
Before setting up a dev container, ensure you have the following installed:

1. Docker:

Install Docker Desktop (Windows/macOS) or Docker Engine (Linux).
2. Visual Studio Code:

Download and install VS Code from <https://code.visualstudio.com/>.
3. Dev Containers Extension:

Install the 'Dev Containers' extension from the VS Code Extensions Marketplace.
4. Create new or open existing project
5. Open the Command Palette in VS Code `(Ctrl+Shift+P or Cmd+Shift+P)` and search for `Dev Containers: Add Development Container Configuration Files`.
6. Choose a Predefined Template:

VS Code provides templates for popular development stacks (e.g., PHP, Python, Java). Select the template that best suits your project.

Alternatively just create the file manually.
Expand All @@ -36,9 +40,7 @@ At this point you will have a `.devcontainer` folder in your project directory w
- `devcontainer.json`: The main configuration file that defines the container’s settings.
- `Dockerfile` (optional): for custom container configurations.

You can now modify the `devcontainer.json` to include any tools, extensions, or configurations you or your team requires. For example:

<!--listend-->
You can now modify the `devcontainer.json` to include any tools, extensions, or configurations you or your team requires. For example:

```json
{
Expand Down Expand Up @@ -85,16 +87,25 @@ When you have finished editing the `devcontainer.json` file you can reopen the p
In summary, the advantages of using dev containers are:

- Consistency:

Every team member works with the same tools, dependencies and configurations, eliminating the 'works on my machine' problem.
- Simplified onboarding:

New developers can start contributing quickly by simply cloning the repository and opening it in a Dev Container. All necessary dependencies and tools are pre-configured.
- Isolation:

Dev Containers prevent environment conflicts by isolating dependencies from the host machine.
- Integrated Workflow:

Unlike standalone Docker containers, Dev Containers integrate tightly with VS Code, enabling features like IntelliSense, debugging and version control within the container.
- Reproducibility:
The configuration files ensure that the same environment can be reproduced anywhere, whether locally or in CI/CD pipelines.

The configuration files ensure that the same environment can be reproduced
anywhere, whether locally or in CI/CD pipelines.
- Customizability:

Dev Containers can be tailored to include specific extensions, tools, or even custom runtime environments, making them flexible for diverse projects.

Therefore, by leveraging dev containers, development teams can streamline collaboration, maintain consistent environments, and boost productivity. They bridge the gap between containerised workflows and developer friendly tools, making them an excellent choice for modern development practices.
Therefore, by leveraging dev containers, development teams can streamline collaboration, maintain consistent environments and boost productivity. They bridge the gap between containerised workflows and developer friendly tools, making them an excellent choice for modern development practices.

For more info, read the docs [here](https://containers.dev/).

0 comments on commit c836c94

Please sign in to comment.