The base image for the bfren ecosystem, containing Alpine Linux and various helper executables.
Source files (GitHub) Container images (Docker Hub)
Docker Alpine is a tiny distribution of Linux designed specifically for use in containers.
esh is a lightweight templating engine using POSIX-compatible syntax.
x.x and x.x.x refer to the bfren image versions.
Alpine Version | Tags |
---|---|
In addition, you can add -dev
and -beta
suffixes to access development / test builds (see Docker Hub for further details).
Name | Values | Description | Default |
---|---|---|---|
If you need to build the image with a different timezone to the default ("Europe/London"), you can do so by setting the TZ
ARG, or by installing the tzdata
package. (Please note this is only possible if you are building the image yourself - otherwise you will need to use bf-tz.)
As well as the standard repositories, the edge repos are tagged with @edgemain
and @edgecomm
. This means you can, for example, do apk add curl@edgemain
or apk add php8@edgecomm
to add the edge versions of packages.
This image contains only one service: cron
, which is enabled by default. If you want to add scripts or executables to the cron you have two options.
/etc/periodic/
The simplest way to add tasks to the cron in Alpine Linux is to place an executable file in one of the directories under /etc/periodic/
(remember to set the executable attribute in /etc/fix-attrs.d/
):
It's pretty obvious how frequently they run! An example of this method can be found in the Nginx PHP image.
/etc/crontabs/root
If you want more control over your cron tasks you can create a normal crontab file:
However, if you do this, remember you will be overriding the default file when your /overlay/
is copied over the image files, so you need to include the default directives if you don't want to break the cron further down the line.
The image comes pre-installed with esh, a simple shell-based templating engine. It is extremely lightweight, and very easy to use.
All dynamic configuration files in the bfren ecosystem are built using esh, and the default location for those templates is /etc/bf/templates
.
3.12
alpine3.12, alpine3.12.9, alpine3.12-x.x, alpine3.12-x.x.x
3.13
alpine3.13, alpine3.13.7, alpine 3.13-x.x, alpine3.13-x.x.x
3.14
alpine3.14, alpine3.14.3, alpine3.14-x.x, alpine3.14-x.x.x
3.15
latest, alpine3, alpine3.15, alpine3.15.0, alpine3.15-x.x, alpine3.15-x.x.x
edge
alpineedge, alpineedge-x.x, alpineedge-x.x.x
BF_DEBUG
0 or 1
Set to 0 to disable debug log output messages.
1
Various helper executables for providing standard output and simplifying common tasks.
Echoes "$1
: $2
" to stdout
in grey with prefix (see bf-e) - but only if environment variable BF_DEBUG
is set to "1".
Text to output
[Optional] Script / executable name
Echoes 'done.' to stdout
in green with prefix (see bf-ok).
[Optional] Script / executable name
Echoes $3
to stdout
in colour $2
with prefix:
"[$1
] %Y-%m-%d %H:%M:%S".
Namespace (default value for other output helper executables is 'bf')
ANSI colour code (see e.g. here)
Text to output
[Optional] Script / executable name
Echoes "$1
: $2
" to stdout
in default colour with prefix (see bf-e).
Text to output
[Optional] Script / executable name
Echoes "$1
: $2
" to stdout
in red with prefix (see bf-e), and returns 1. This will end execution of the calling script if you use, e.g. set -euo pipefail
at the top of your scripts (recommended).
Text to output
[Optional] Script / executable name
Like bf-error echoes "$1
: $2
" to stdout
in red with prefix, but doesn't end execution of calling script.
Text to output
[Optional] Script / executable name
Echoes "$1
: $2
" to stdout
in green with prefix.
Text to output
[Optional] Script / executable name
Create user with id $2
, group with id $3
, both with name $1
, and no password.
User and group name
[Optional] User ID (default: 1000)
[Optional] Group ID (default: UID)
Changes ownership and/or permissions of file / directory glob.
Required (one or both):
-o X
use chown
to set ownership to "X"
-m Y
use chmod
to set permissions to "Y"
Optional:
-t f|d
apply only to files ("f") or directories ("d")
-r
if -t
is not specified, applies action recursively to all files and directories
Clears contents of /tmp
and apk
cache.
Calls esh
in a consistent manner.
Path to input (template) file
Path to output (generated) file
Display name and version of the current image, and a link to the GitHub repository.
Run install /tmp/install
and then perform cleanup (see bf-clear). Within the ecosystem this would normally be used in a Dockerfile
This is the basic structure of Dockerfiles based on the Alpine S6 image, copying overlay and then running the standard installation.
Runs rm -rf $1
safely: doing nothing if $1
is empty. This is handy if the path you are deleting is contained in a variable (it effectively stops rm -rf /
!).
Folder path / file glob to delete.
Generates a string of random letters and numbers of length $1
.
[Optional] Number of characters to return
Uses wget
to test URL $1
.
URL to test
Sets the container's timezone to $1
. (Installs tzdata
package, changes timezone and then removes tzdata
).
Valid timezone (e.g. Europe/London)
Note the change in time on line 12.