• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 6 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

minimalistic docker base image to build and deploy apps

baseimage Actions

minimal docker base image to build and deploy services and applications.

Three images provided:

  1. go build image - umputun/baseimage:buildgo-latest. For build stage, includes go compiler and linters. Alpine based.
  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.

  • Relatively small, based on the official golang:alpine image
  • Enforces CGO_ENABLED=0
  • With fully installed and ready to use golangci-lint
  • Add useful packages for building and testing - testify, mockery and moq
  • Includes goreleaser and statik
  • With 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.

  • ENTRYPOINT /init.sh runs CMD via dumb-init
  • 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.

Run-time Customization

The container can be customized in runtime by setting environment from docker's command line or as a part of docker-compose.yml

  • TIME_ZONE - set container's TZ, default "America/Chicago". For scratch-based TZ should be used instead
  • APP_UID - UID of internal app user, default 1001

Example of multi-stage Dockerfile with baseimage:buildgo and baseimage:app

FROM umputun/baseimage:buildgo as build

WORKDIR /build
ADD . /build

RUN go test -mod=vendor ./...
RUN golangci-lint run --out-format=tab --tests=false ./...

RUN \
    revison=$(/script/git-rev.sh) && \
    echo "revision=${revison}" && \
    go build -mod=vendor -o app -ldflags "-X main.revision=$revison -s -w" .


FROM umputun/baseimage:app

COPY --from=build /build/app /srv/app

EXPOSE 8080
WORKDIR /srv

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:

  • 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.

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

More Repositories

1

remark42

comment engine
Go
4,881
star
2

reproxy

Simple edge server / reverse proxy
Go
1,212
star
3

spot

A user-friendly and efficient tool for the effortless deployment and configuration of resources on remote machines.
Go
349
star
4

docker-logger

Logs collector for docker
Go
246
star
5

secrets

secrets kept safe
Go
143
star
6

tg-spam

Anti-Spam bot for Telegram
Go
140
star
7

feed-master

Pulls multiple podcast feeds (RSS) and republishes as a common feed, properly sorted and podcast-client friendly.
Go
116
star
8

updater

Simple web-hook based receiver executing things via HTTP request
Go
108
star
9

cronn

cron service with extras
Go
85
star
10

dkll

Agent, server and client to collect and access logs in dockerized infrastructure
Go
66
star
11

rss2twitter

publish rss updates to twitter
Go
56
star
12

sys-agent

System agent. Reports server status via HTTP API
Go
50
star
13

github-backup-docker

Docker wrapper for github-backup
Shell
49
star
14

echo-http

Echo http service
Go
44
star
15

monit-docker

Dockerized monit
Python
43
star
16

rlb

Redirecting Load Balancer
Go
40
star
17

ghost-buster-docker

Ready to use ghost with buster and auto-generation in docker container
Shell
39
star
18

proxy-cron

A simple proxy with crontab scheduling
Go
14
star
19

pi-radio

Python
14
star
20

mongo-auth

mongo docker with auth
Shell
12
star
21

rlb-stats

Stats collector and reporter for RLB
Go
7
star
22

le-dns-updater

Update LE certs with DNS challenge
Shell
3
star
23

remark42-site

remark42.com site
HTML
2
star
24

umputun.dev

umputun.dev website
HTML
2
star
25

fm-config

FeedMaster configuration for podcasts
Dockerfile
1
star
26

esvn

GUI frontend to the Subversion revision system
HTML
1
star
27

homebrew-apps

Homebrew thing
Ruby
1
star