This is my opinionated attempt to build a "lightweight" docker image powerful enough to run vscode remote containers or to be used as a base image to create docker container GitHub Actions.
The not-that-lightweight actually means that while ubuntu:latest is ~78MB, this image is ~90MB. Yes, this translates to extra 12MB compared to ubuntu, but the preinstalled tools are by far more comprehensive (see bellow).
- Based on Alpine instead of Ubuntu. This translates to musl being used instead of glib, but compatibility libraries are also preinstalled.
- Its is Alpine, but using bash instead of ash.
- By using tini, we ensure that child processes are correctly reaped.
- Default user coder and group coder using UID and GID = 1000, to ease volume-mapping permissions issues.
- Passwordless, sudo support: easily install extra packages with apk (e.g,
sudo apk add docker-cli jq
) - Preinstalled node (v16.19.1) and npm (8.10.0) !!!
- Preinstalled tooling (git, curl, socat, openssh-client, nano, unzip, brotli, zstd, xz) !!!
- Image is hosted on GitHub Container Registry, hence we get fast pulls whenever using this image with GitHub Actions.
- Whenever possible, install software directly from the Alpine repositories, i.e. use apk instead of downloading / manually installing them.
- Keep it small: do not cross the 100MB image size boundary.
- Multi arch (amd64 && arm64)
# docker run -it ghcr.io/raonigabriel/coder-core:latest
coder@65dc49a66e7c:~$
FROM ghcr.io/raonigabriel/coder-core:latest
# Installing Java and tools
RUN sudo apk --no-cache add maven gradle
# Setup env variables
ENV JAVA_HOME=/usr/lib/jvm/default-jvm \
MAVEN_HOME=/usr/share/java/maven-3 \
GRADLE_HOME=/usr/share/java/gradle
See my spring-qrcode-example for a full example on how to setup a remote container for development.
- This code comes with no warranty. Use it at your own risk.
- I don't like Apple. Fuck off, fan-boys.
- I don't like left-winged snowflakes. Fuck off, code-covenant.
- I will call my branches the old way. Long live master, fuck-off renaming.