Skip to content

minimalistic docker base image to build and deploy apps

License

Notifications You must be signed in to change notification settings

umputun/baseimage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baseimage Docker Automated build Build Status

minimalist docker base image to build and deploy my services and applications.

Two images included:

  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

Go Build Image

Image 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 and GOARCH=amd64
  • Adds vendor tool dep and govendor
  • With fully installed and ready to use linters gometalinter and golangci-lint
  • Add useful packages for building and testing - testify, mockery and go-bindata
  • With goveralls for easy integration with coverage services and provided coverage.sh script to report coverage.
  • git-rev.sh script to make git-based version without full .git copied (works without .git/objects)

Example of Dockerfile from baseimage:buildgo

FROM umputun/baseimage:buildgo-latest as build-backend

WORKDIR /go/src/github.com/umputun/remark

ADD app /go/src/github.com/umputun/remark/app
ADD vendor /go/src/github.com/umputun/remark/vendor
ADD .git /go/src/github.com/umputun/remark/.git

RUN cd app && go test ./...

RUN gometalinter --disable-all --deadline=300s --vendor --enable=vet --enable=vetshadow --enable=golint \
    --enable=staticcheck --enable=ineffassign --enable=goconst --enable=errcheck --enable=unconvert \
    --enable=deadcode  --enable=gosimple --enable=gas --exclude=test --exclude=mock --exclude=vendor ./...

RUN mkdir -p target && /script/coverage.sh

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

Base Application Image

Image 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
  • Optionally runs /srv/init.sh if provided by custom container
  • Packages tzdata, curl and openssl
  • Adds user app (uid=1001)