$ make echo "root module" root module export REPO=github.com/zhongmingmao/go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ make build echo "building httpserver binary" building httpserver binary mkdir -p bin/amd64 # cgo is disabled by default when cross-compiling CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/amd64 .
$ make release echo "building httpserver binary" building httpserver binary mkdir -p bin/amd64 # cgo is disabled by default when cross-compiling CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/amd64 . echo "building httpserver container" building httpserver container docker build -t zhongmingmao/httpserver:v1.0 . [+] Building 2.1s (7/7) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/ubuntu:latest 1.5s => CACHED [1/2] FROM docker.io/library/ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 0.0s => => resolve docker.io/library/ubuntu@sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 0.0s => [internal] load build context 0.2s => => transferring context: 7.18MB 0.2s => [2/2] ADD bin/amd64/httpserver /httpserver 0.1s => exporting to image 0.1s => => exporting layers 0.1s => => writing image sha256:8888321aaf823469a6d9d56aefdce48f723a2a9061266a5684f7b1ad93231ed5 0.0s => => naming to docker.io/zhongmingmao/httpserver:v1.0 0.0s $ docker images --filter 'label=multi.l1=v1' --filter 'label=multi.l2=v2' --filter 'label=other=v3' REPOSITORY TAG IMAGE ID CREATED SIZE zhongmingmao/httpserver v1.0 e446f5f2b042 57 minutes ago 80MB
1 2 3 4 5 6 7 8 9 10
$ docker run -it --rm -p 8888:80 zhongmingmao/httpserver:v1.0 ERROR: logging before flag.Parse: I0215 08:52:31.904324 8 httpserver.go:17] Starting http server...
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a1ce23f6bd41 zhongmingmao/httpserver:v1.0 "/bin/sh -c /httpser…" 17 seconds ago Up 15 seconds 0.0.0.0:8888->80/tcp busy_heisenberg