Introduction
The motivation of the gnu-on-alpine and alpine-plus-plus Docker containers is the implementation of GitHub Container Actions via shell scripting. They are built upon alpine to keep the image size small for fast loading within GitHub Actions, and both are preinstalled with bash, coreutils, findutils, and gawk; and alpine-plus-plus is additionally preinstalled with git.
Both gnu-on-alpine and alpine-plus-plus are multiplatform images supporting the following platforms:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le
- linux/s390x
Table of Contents:
- Introduction
- Motivation
- Docker Tags and Versioning Scheme
- Installing
- Learn More
- Where You Can Find Me
Motivation
GitHub Actions can be implemented in a couple ways. The most common is with JavaScript. However, another way to implement a GitHub Action is as a container action. As a container action, you can use any language to implement the action, provided the container includes all of the tools that your action requires.
One simple approach is to use your favorite Linux distribution as the base image for your container, and to define the steps to install any tools that your action needs (e.g., compilers, interpreters, CLI tools, etc) within the Dockerfile of your action. The problem with that approach is that whenever a workflow of one of your users runs, the container for your action is built, which in this case includes installing the various tools that it needs.
A better approach that speeds up runs of your action is to use a base image that includes all of the tools that your action requires. This way, your Dockerfile only requires the steps necessary to copy the source of your action into the container and to set an entrypoint. Here is an example of the Dockerfile of one of my GitHub Actions (note this one doesn't use the containers that are the subject of this post):
FROM ghcr.io/cicirello/pyaction:4.16.0
COPY tidyjavadocs.py /tidyjavadocs.py
ENTRYPOINT ["/tidyjavadocs.py"]
Docker Tags and Versioning Scheme
I push images to both Docker Hub and the GitHub Container Registry with the following tags:
- The tag
latest
indicates, well, the latest image. - Tags of the form MAJOR.MINOR.PATCH (such as 3.17.2) indicate the Semantic Version of the Alpine image used as the base.
- Tags of the form MAJOR.MINOR (e.g., 3.17) correspond to the most recent patch level of the Alpine image used as the base. For example, if 3.17.2 is the latest release, then 3.17 maps to this as well.
- Tags of the form MAJOR (e.g., 3) correspond to the most recent patch level of the Alpine image used as the base, with major corresponding major version. For example, if 3.17.2 is the latest release, then 3 maps to this as well.
I use GitHub's dependabot to monitor for updates to the base Alpine image.
Installing
The pre-built images are hosted on both Docker Hub and the GitHub Container Registry. You can use it in the following ways.
Docker Pull Command
Pull the latest images from Docker Hub with the following (or replace with tag of desired version):
docker pull cicirello/gnu-on-alpine:3.17.2
Or for alpine-plus-plus:
docker pull cicirello/alpine-plus-plus:3.17.2
Pull from the Github Container Registry with:
docker pull ghcr.io/cicirello/gnu-on-alpine:3.17.2
Or for alpine-plus-plus:
docker pull ghcr.io/cicirello/alpine-plus-plus:3.17.2
Use as a base image in a Dockerfile
Use as a base image in a Dockerfile (or replace with tag of desired version):
FROM cicirello/gnu-on-alpine:3.17.2
# The rest of your Dockerfile would go here.
Or for alpine-plus-plus:
FROM cicirello/alpine-plus-plus:3.17.2
# The rest of your Dockerfile would go here.
Or you can use as a base image (via the Github Container Registry) with:
FROM ghcr.io/cicirello/gnu-on-alpine:3.17.2
# The rest of your Dockerfile would go here.
Or for alpine-plus-plus:
FROM ghcr.io/cicirello/alpine-plus-plus:3.17.2
# The rest of your Dockerfile would go here.
Learn More
To learn more, consult the GitHub repositories:
cicirello / gnu-on-alpine
A lightweight docker image for shell scripting with GNU tools
gnu-on-alpine
A lightweight docker image for shell scripting with GNU tools (Alpine plus bash, coreutils, findutils, gawk)
Summary
The gnu-on-alpine Docker image is designed to support shell scripting using GNU tools such as the bash shell, gawk, coreutils, and findutils, while keeping the image size relatively small. Alpine Linux is used as the base image. The gnu-on-alpine image adds bash, findutils, coreutils, and gawk on top of Alpine Linux.
Multiplatform Image
gnu-on-alpine has the following platforms available:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le
- linux/s390x
Source Repository and Builds
The source repository is maintained on GitHub. The images are built on Github and pushed to Docker Hub, as well as the Github Container Registry using Github Actions.
Docker Tags and Versioning Scheme
Each image pushed to Docker Hub and the Github Container Registry is tagged as follows:
- The tag
latest
indicates…
cicirello / alpine-plus-plus
A lightweight docker image for shell scripting and git
alpine-plus-plus
A lightweight docker image for shell scripting and git (Alpine plus bash, coreutils, findutils, gawk, git)
Summary
The alpine-plus-plus Docker image is motivated by Github-actions implemented primarily with bash and shell utilities, but is also potentially applicable to any use-case where you primarily need bash and GNU tools like gawk, etc, as well as git, but also want to keep the image size relatively small. Alpine Linux is used as the base image. Alone, Alpine almost suits this purpose However, it lacks the bash shell, and commonly used GNU tools such as findutils, gawk, etc. It also lacks git. The alpine-plus-plus image adds git, bash, findutils, coreutils, and gawk on top of Alpine Linux.
Multiplatform Image
alpine-plus-plus has the following platforms available:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le
- linux/s390x
Source Repository and Builds
The source repository is maintained on GitHub…
Where You Can Find Me
Follow me here on DEV:
Follow me on GitHub:
Vincent A Cicirello
If you want to generate the equivalent to the above for your own GitHub profile, check out the cicirello/user-statistician GitHub Action.
Or visit my website:
Top comments (0)