georglauterbach / dev-container-base

Development Container Base Image for Common Tasks
https://github.com/georglauterbach/dev-container-base
MIT License
0 stars 0 forks source link
containers dev-container development-container

= Custom Development Container Base Image :toc:

== About

A custom https://containers.dev/[Development Container] base image packed with as many as necessary and as few as possible configurations and applications to make development a breeze. This image is built for amd64 and arm64. Consult link:./Dockerfile[Dockerfile] for the complete set of installation steps.

This container image partially builds on https://github.com/georglauterbach/hermes[_Hermes_] to install sensible defaults for the console and useful additional programs. Consult the documentation of Hermes if you'd like to further customize the experience.

Additonally, we configure common directories (like ${HOME}/.cache) with the correct permissions. We also set up doas so that you can simply run sudo inside the container without the need to enter a password.

You can use the environment variable DEV_CONTAINER_BASE to check whether you are using this image as a base (and hence, whether you are inside a container). This variable, if set, contains the version of the base image and the version control system revision, separated by a #.

We do not set a custom ENTRYPOINT with this image because the entrypoint is overwritten by Development Containers anyway, and we want to make the additional setup optional.

== Optional Additional Setup

=== Proper Caching

To properly persist data that should be cached, you need to provide volumes in devcontainer.json for the following directories:

[source,jsonc]

{ // Persist the VS Code extension cache "source": "-cache-vscode_extensions", "target": "/home/ubuntu/.vscode-server/extensions", "type": "volume" }, { // Persist the ${HOME}/.cache directory "source": "-cache-home_cache", "target": "/home/ubuntu/.cache", "type": "volume" }

[IMPORTANT]

While this image performs permission adjustments for /home/ubuntu/.vscode-server, you should mount the volume for caching extensions to /home/ubuntu/.vscode-server/extensions. Otherwise, the Development Container settings are https://news.ycombinator.com/item?id=23113314[cached] as well, which may leed to your settings not being updated.

=== Locale Setup

When building on top of this image, you can call sudo update_locales.sh <LOCALE> to set a new locale. The default is en_US.UTF-8.