Skip to content

Commit

Permalink
feat: add devcontainer specification (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryMaciek authored Aug 16, 2024
1 parent 07c6da9 commit b7021f7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "dev",

"build": {
"dockerfile": "./Dockerfile"
},

"postCreateCommand": "bash /bin/entrypoint.sh",

"customizations": {
"codespaces": {
"openFiles": []
}
}
}
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Angry Runner (😠🏃‍♂️)

Delicious recipe for a Docker image suitable for self-hosted GitHub Actions runners as well as local dev.
Delicious recipe for a Docker image suitable for: (1) self-hosted GitHub Actions runners, (2) local development environment as well as (3) GitHub codespaces base for the devcontainer mechanism.

Enjoy!

Expand All @@ -14,7 +14,7 @@ _~AngryMaciek_

### Brief description

The base image here is the popular `ubuntu:22:04` - that is to increase the similarity of the container system to users OSs; A few system tools come pre-installed: [GNU Bash](https://www.gnu.org/software/bash/), [gcc & g++](https://gcc.gnu.org/), [Git](https://git-scm.com/), [GNU Make](https://www.gnu.org/software/make/), [CMake](https://cmake.org/), [Vim](https://www.vim.org/) and most importantly - [mambaforge](https://github.com/conda-forge/miniforge), which has been set up for the (default) root user; port `8888` is exposed to the host machine; dir `/workdir` is available to mount a volume; an entrypoint script has been designed to add a new non-root linux user which can access conda via a system's group; executing commands as `angryuser` is available through [gosu](https://github.com/tianon/gosu).
The base image here is the popular `ubuntu:22:04` - that is to increase the similarity of the container system to users OSs; A few system tools come pre-installed: [GNU Bash](https://www.gnu.org/software/bash/), [gcc & g++](https://gcc.gnu.org/), [Git](https://git-scm.com/), [GNU Make](https://www.gnu.org/software/make/), [CMake](https://cmake.org/), [Vim](https://www.vim.org/) and most importantly - [mambaforge](https://github.com/conda-forge/miniforge), which has been set up for the (default) root user; port `8888` is exposed to the host machine; dir `/workspace` is available to mount a volume; an entrypoint script has been designed to add a new non-root linux user which can access conda via a system's group; executing commands as `angryuser` is available through [gosu](https://github.com/tianon/gosu).

Useful references:
* https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
Expand Down Expand Up @@ -70,8 +70,22 @@ docker pull angrymaciek/angry-runner:latest
Run the container with:

```bash
docker run --name angry-runner -e HOSTUID=`id -u $USER` -p 8888:8888 -it -v $HOME:/workdir angrymaciek/angry-runner:latest
docker run --name angry-runner -e HOSTUID=`id -u $USER` -p 8888:8888 -it -v $HOME:/workspace angrymaciek/angry-runner:latest
```

In the example above my whole home directory is mounted as the volume.
This may, of course, be adjusted.

### Codespaces (devcontainer)

The following repository is configured to push each new version of the image
to my DockerHub. Feel free to use it as a base for your development
container through the `devcontainer` mechanism; include these lines in your JSON:

```json
"image": "angrymaciek/angry-runner:latest",
"postCreateCommand": "bash /bin/entrypoint.sh",
```

By default the container starts as root, though one may swiftly change
to the developer shell with: `gosu angryuser bash`.

0 comments on commit b7021f7

Please sign in to comment.