1
- # lightweight- devcontainer-templates
1
+ # devcontainer-templates
2
2
3
- My personal, lightweight alternatives to the [ default devcontainer templates ] [ vsc_defaults ] .
3
+ A set of devcontainer templates following the nascent [ devcontainer template spec ] [ spec_proposal ] .
4
4
5
- ## Motivation
5
+ This repository contains both "barebones" templates aiming to be more lightweight and "batteries
6
+ excluded" than the [ default templates] [ vsc_defaults ] , and some more complex "opinionated" templates
7
+ that reflect my personal perspective on a good starting point for new projects in ecosystems/stacks
8
+ I frequently use.
6
9
10
+ ## Motivation
7
11
[ Development containers] [ devcontainers ] ("devcontainers") are a core part of my development
8
12
workflow. Microsoft curates an ecosystem of images, templates, and plug-in features that allow users
9
13
to get started quickly and provide deep integration into VS Code.
@@ -17,47 +21,58 @@ default templates, and the preconfigured images that the templates use:
17
21
* The images add a level of abstraction and dependencies that makes them harder to reason about than
18
22
a manually maintained ` Dockerfile `
19
23
* The images are overoptimised for integration with Microsoft tooling
20
- * The generated configuration contains lots of scaffolding that is often left in by developers but
21
- gets outdated as the spec evolves
24
+ * The generated configuration contains lots of superfluous scaffolding that is often left in by
25
+ developers or left commented but gets outdated as the spec evolves
26
+ * The generated configuration for some stacks/ecosystems could be more useful in terms of including
27
+ best practices to take full advantage of devcontainers
22
28
23
- Some of these issues can be worked around by overriding the default configuration, but still add
24
- cruft. I was looking for a more "bring your own batteries" approach.
29
+ I was looking for a more barebones, explicit, and customisable approach on the one hand, and some
30
+ more specific and opinionated templates on the other. A set of templates that I could use to set up
31
+ a new project in minimal time, without having to refer back to previous projects for inspiration,
32
+ and that I could evolve as time goes on.
25
33
26
- That said, I'm sure the default templates and images are a great help to less experienced developers
27
- who just want to get started quickly, and those who aren 't as familiar with the Docker ecosystem,
28
- so they do have their place .
34
+ Consider these templates to complement the default "official" ones - especially for inexperienced
35
+ developers and those who don 't want to have to customise their environment, the official templates
36
+ are probably a better choice .
29
37
30
38
## Goals
39
+ Ultimately, the primary goal of these templates is to meet my need for professional-grade templates
40
+ to use when I set up a new project, without having to refer back to previous projects for
41
+ inspiration, and that I could evolve as time goes on and the spec and my needs change.
31
42
32
- Ultimately, the primary goal of these templates is to meet my need of simple templates to use when
33
- I start a new project - both production-grade projects and throwaway experiments - and avoid the
34
- need to have to copy and adapt configuration from a previous project.
35
-
36
- The templates should have:
37
- * Trivial configuration that is easy to understand, extend, customise, and maintain
38
- * Default upstream Docker images for the target language/ecosystem
39
- * No tooling and customisation by default, beyond scaffolding required to:
40
- * run a basic application in the target language/ecosystem, and
41
- * be able to install additional development tools on a non-root user level (as the upstream
42
- images are geared towards production deployments)
43
+ The templates should:
44
+ - set a "gold standard" for how I would set up a new (or existing) project for a given stack to use
45
+ devcontainers
46
+ - have simple configuration that is easy to understand, extend, customise, and maintain
47
+ - use default upstream Docker images for the target language/ecosystem
48
+ - keep the footprint of tooling and customisation small (or to the bare minimum in case of
49
+ "barebones" templates)
50
+ - use a non-root user, but allow for ` sudo ` (many upstream images are geared towards production
51
+ deployments and run as ` root ` )
43
52
44
53
## Suggested usage
45
-
46
54
Use the templates to generate a basic devcontainer setup, then customise as follows:
47
55
48
56
* Add OS-level setup and system-level dependencies (e.g. OS package manager packages) to the
49
57
` Dockerfile `
50
58
* Run add project-specific setup and development ecosystem dependency installation using a
51
59
` postCreateCommand ` in ` devcontainer.json ` . If it consists of more than one or two commands,
52
- consider adding a shell script in the ` .devcontainer ` folder and running that
60
+ consider adding a shell script in the ` .devcontainer ` folder and running that (the opinionated
61
+ templates may already have one)
53
62
* Add the minimum necessary set of VS Code extensions and configuration to ` devcontainer.json `
54
63
(leaving space for other contributors/team members to not be overloaded with default setup)
55
64
* Any personal preferences of individual developers (e.g. environment customisation or tool
56
65
installation) should be dealt with using VS Code's ability to auto-inject user dotfiles and run
57
66
an installation script in the process (see the Debian section in [ my personal dotfiles] [ punkt ]
58
67
install script for an example of how to achieve this).
59
68
69
+ ## Contributions
70
+ I've not yet figured out if I want to accept contributions to this repository. If you have an idea
71
+ for a bug fix, improvement, or new template that would fit within the scope and philosophy of this
72
+ project, please open an issue before you put in substantial work!
73
+
60
74
[ devcontainers ] : https://containers.dev
61
75
[ punkt ] : https://github.com/csutter/punkt/blob/main/install.sh
62
76
[ ruby_issue ] : https://github.com/microsoft/vscode-dev-containers/issues/704
77
+ [ spec_proposal ] : https://github.com/devcontainers/spec/blob/main/proposals/devcontainer-templates.md
63
78
[ vsc_defaults ] : https://github.com/devcontainers/templates
0 commit comments