Installing docker on buster is a pain, use alpine to install it
This commit is contained in:
Djordje Lukic 2020-05-20 14:32:56 +02:00
Родитель 95e07a2134
Коммит fe36c49246
9 изменённых файлов: 18 добавлений и 15 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

6
cli/cmd/context/testdata/ls-out.golden поставляемый
Просмотреть файл

@ -1,3 +1,3 @@
NAME TYPE DESCRIPTION DOCKER ENPOINT KUBERNETES ENDPOINT ORCHESTRATOR 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 default docker Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm
example * example example * example

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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() dockerDefault, err := dockerGefaultContext()
if err != nil { if err != nil {
return nil, err return nil, err