Browse Source

Use alpine as base image

Installing docker on buster is a pain, use alpine to install it
Djordje Lukic 5 years ago
parent
commit
fe36c49246

+ 5 - 4
Dockerfile

@@ -1,5 +1,5 @@
 # syntax = docker/dockerfile:experimental
-ARG GO_VERSION=1.14.2
+ARG GO_VERSION=1.14.3-alpine3.11
 
 FROM golang:${GO_VERSION} AS base
 ARG TARGET_OS=unknown
@@ -7,6 +7,8 @@ ARG TARGET_ARCH=unknown
 ARG PWD=/api
 ENV GO111MODULE=on
 
+RUN apk update && apk add docker make
+
 WORKDIR ${PWD}
 ADD go.* ${PWD}
 RUN go mod download
@@ -18,9 +20,7 @@ ARG TARGET_ARCH=unknown
 ARG PWD=/api
 ENV GO111MODULE=on
 
-RUN apt-get update && apt-get install --no-install-recommends -y \
-    protobuf-compiler \
-    libprotobuf-dev
+RUN apk update && apk add protoc make
 
 RUN go get github.com/golang/protobuf/[email protected] && \
     go get golang.org/x/tools/cmd/goimports
@@ -52,4 +52,5 @@ FROM scratch AS cross
 COPY --from=make-cross /api/bin/* .
 
 FROM base as test
+ENV CGO_ENABLED=0
 RUN make -f builder.Makefile test

+ 1 - 1
backend/v1/backend.pb.go

@@ -27,7 +27,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.22.0
-// 	protoc        v3.6.1
+// 	protoc        v3.11.2
 // source: backend/v1/backend.proto
 
 package v1

+ 2 - 2
builder.Makefile

@@ -26,14 +26,14 @@
 GOOS ?= $(shell go env GOOS)
 GOARCH ?= $(shell go env GOARCH)
 
-PROTOS=$(shell find . -name \*.proto)
+PROTOS=$(shell find . -not \( -path ./tests -prune \) -name \*.proto)
 
 EXTENSION :=
 ifeq ($(GOOS),windows)
   EXTENSION := .exe
 endif
 
-STATIC_FLAGS= CGO_ENABLED=0
+STATIC_FLAGS=CGO_ENABLED=0
 LDFLAGS := "-s -w"
 GO_BUILD = $(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
 

+ 3 - 3
cli/cmd/context/testdata/ls-out.golden

@@ -1,3 +1,3 @@
-NAME                TYPE                DESCRIPTION                               DOCKER ENPOINT                KUBERNETES ENDPOINT               ORCHESTRATOR
-default             docker              Current DOCKER_HOST based configuration   unix:///var/run/docker.sock   https://35.205.93.167 (default)   swarm
-example *           example                                                                                                                       
+NAME                TYPE                DESCRIPTION                               DOCKER ENPOINT                KUBERNETES ENDPOINT   ORCHESTRATOR
+default             docker              Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
+example *           example                                                                                                           

+ 2 - 2
cli/cmd/ps_test.go

@@ -75,7 +75,7 @@ func (sut *PsSuite) TestPs() {
 	}
 
 	err := runPs(sut.ctx, opts)
-	assert.NilError(sut.T(), err)
+	assert.Nil(sut.T(), err)
 
 	golden.Assert(sut.T(), sut.getStdOut(), "ps-out.golden")
 }
@@ -86,7 +86,7 @@ func (sut *PsSuite) TestPsQuiet() {
 	}
 
 	err := runPs(sut.ctx, opts)
-	assert.NilError(sut.T(), err)
+	assert.Nil(sut.T(), err)
 
 	golden.Assert(sut.T(), sut.getStdOut(), "ps-out-quiet.golden")
 }

+ 1 - 1
cli/v1/cli.pb.go

@@ -27,7 +27,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.22.0
-// 	protoc        v3.6.1
+// 	protoc        v3.11.2
 // source: cli/v1/cli.proto
 
 package v1

+ 1 - 1
compose/v1/compose.pb.go

@@ -27,7 +27,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.22.0
-// 	protoc        v3.6.1
+// 	protoc        v3.11.2
 // source: compose/v1/compose.proto
 
 package v1

+ 1 - 1
containers/v1/containers.pb.go

@@ -27,7 +27,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.22.0
-// 	protoc        v3.6.1
+// 	protoc        v3.11.2
 // source: containers/v1/containers.proto
 
 package v1

+ 2 - 0
context/store/store.go

@@ -264,6 +264,8 @@ func (s *store) List() ([]*Metadata, error) {
 		}
 	}
 
+	// The default context is not stored in the store, it is in-memory only
+	// so we need a special case for it.
 	dockerDefault, err := dockerGefaultContext()
 	if err != nil {
 		return nil, err