Skip to content

Commit

Permalink
add scratch description to readme, format readme
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed May 10, 2024
1 parent 2e83ef7 commit 58b352a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Three images provided:
2. base application image `umputun/baseimage:app-latest`
3. scratch-based application image `umputun/baseimage:scratch-latest`


## Go Build Image

Image `umputun/baseimage:buildgo-latest` and `ghcr.io/umputun/baseimage/buildgo:latest` intends to be used in multi-stage `Dockefile` to build go applications and services.
Expand All @@ -21,18 +20,26 @@ Image `umputun/baseimage:buildgo-latest` and `ghcr.io/umputun/baseimage/buildgo:
* With [goveralls](https://github.com/mattn/goveralls) for easy integration with coverage services and provided `coverage.sh` script to report coverage.
* `/script/version.sh` script to make git-based version


## Base Application Image

Image `umputun/baseimage:app-latest` and `ghcr.io/umputun/baseimage/app:latest` designed as a lightweight, ready-to-use base for various services. It adds a few things to the regular [alpine image](https://hub.docker.com/_/alpine/).

* `ENTRYPOINT /init.sh` runs `CMD` via [dumb-init](https://github.com/Yelp/dumb-init/)
* Container command runs under `app` user with uid `$APP_UID` (default 1001)
* Container command runs under `app` user with uid `$APP_UID` (default 1001)
* Optionally runs `/srv/init.sh` if provided by custom container
* Packages `tzdata`, `curl`, `su-exec`, `ca-certificates` and `openssl` pre-installed
* Adds the user `app` (uid=1001)
* By default enforces non-root execution of the command. Optional "/init-root.sh" can be used to run as root.

## Scratch-based Application Image

Image `umputun/baseimage:scratch-latest` and `ghcr.io/umputun/baseimage/scratch:latest` provide a lightweight, scratch-based runtime image for Go applications.

* **Small size** - The overall image size is approximately 4MB.
* **Zoneinfo** - Includes zoneinfo for timezone support using the `TZ` environment variable.
* **SSL certificates** - Pre-installed SSL certificates (ca-certificates).
* **User and Group** - `/etc/passwd` and `/etc/groups` include an `app` user and group (UID: 1001, GID: 1001).
* **NOP Program** - Provides a small `/nop` program that waits indefinitely.

### Run-time Customization

Expand Down Expand Up @@ -71,16 +78,16 @@ CMD ["/srv/app", "param1", "param2"]
It will make a container running "/srv/app" (with passed params) under 'app' user.

To customize both TIME_ZONE and UID - `docker run -e TIME_ZONE=America/New_York -e APP_UID=2000 <image>`

## Base Scratch Image

Image `umputun/baseimage:scratch-latest` (or `ghcr.io/umputun/baseimage/scratch`) adds a few extras to the `scratch` (empty) image:
Image `umputun/baseimage:scratch-latest` (or `ghcr.io/umputun/baseimage/scratch`) adds a few extras to the `scratch` (empty) image:

- zoneinfo to allow change the timezone of the running application
- SSL certificates (ca-certificates)
- `/etc/passwd` and `/etc/groups` with `app` user and group added (UID:1001, GID:1001)
- `/nop` program to wait forever and do nothing

Container sets user to `app` and working directory to `/srv`, no entrypoint set. In order to change time zone `TZ` env can be used.
Container sets user to `app` and working directory to `/srv`, no entrypoint set. In order to change time zone `TZ` env can be used.

The overall size of this image is about 1M only.

0 comments on commit 58b352a

Please sign in to comment.