No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.gitignore
Dockerfile
DockerfileAlpine
DockerfileBuilder
DockerfileMin
Makefile
README.md
build.log
ca-certificates.crt
hello.go
local_build.sh

README.md

golang hello world

CircleCI

docker images with docker build pattern, docker cache and from scratch based dockerfile

preconditions

build

$ make build

run

$ make run
go build -o mybinary -v ./...
./mybinary
2018/06/23 09:07:25 Server at http://localhost:1234.

5 ways to build a docker image

$ make build.docker
$ make build.docker-cache
$ make build.dockerbuilder
$ make build.dockerbuilder-cache
$ make build.dockerbuilder-min
note about ca-certificates
# $ make build.dockerbuilder-min
# requires ca-certificates.crt file in project directory
# For many Linux distributions, 
# you can copy the file from /etc/ssl/certs/ca-certificates.crt :
cp /etc/ssl/certs/ca-certificates.crt .
build.log shows
  • docker image build times
  • docker image sizes
docker run
docker run -p 1234:1234 dockerhub/hellogo:[tag] -name hellogodocker
# e.g. docker run -p 1234:1234 --name hellogodocker dockerhub/hellogo:dd70981-dirty20180710223321
docker experimental

In order to run the squash build commands above, you need to run the docker deamon with experimental functions:

$ cat <<EOT >> /etc/docker/daemon.json
{ 
    "experimental": true 
} 
EOT
$ sudo service docker restart

#check result
$ docker version -f '{{.Server.Experimental}}'
true

blog post

let’s go build a minimal docker image