mirror of https://github.com/docker/compose.git
commit
17ffa84495
|
@ -1,12 +1,25 @@
|
||||||
name: Continuous integration
|
name: Continuous integration
|
||||||
|
|
||||||
on:
|
on: [push]
|
||||||
[push]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run golangci-lint
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
GOROOT: ""
|
||||||
|
uses: actions-contrib/golangci-lint@v1
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO111MODULE: "on"
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.14
|
- name: Set up Go 1.14
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
|
@ -17,14 +30,18 @@ jobs:
|
||||||
- name: Checkout code into the Go module directory
|
- name: Checkout code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Lint
|
- uses: actions/cache@v1
|
||||||
run: make lint
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
- name: Build
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
run: make cli
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: make test
|
run: make -f builder.Makefile test
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make -f builder.Makefile cli
|
||||||
|
|
||||||
- name: E2E Test
|
- name: E2E Test
|
||||||
run: make e2e-local
|
run: make e2e-local
|
||||||
|
|
35
Dockerfile
35
Dockerfile
|
@ -1,38 +1,47 @@
|
||||||
# syntax = docker/dockerfile:experimental
|
# syntax = docker/dockerfile:experimental
|
||||||
ARG GO_VERSION=1.14.2
|
ARG GO_VERSION=1.14.2
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS fs
|
FROM golang:${GO_VERSION} AS base
|
||||||
|
ARG TARGET_OS=unknown
|
||||||
|
ARG TARGET_ARCH=unknown
|
||||||
|
ARG PWD=/api
|
||||||
|
ENV GO111MODULE=on
|
||||||
|
|
||||||
|
RUN go get github.com/golang/protobuf/protoc-gen-go@v1.4.1
|
||||||
|
|
||||||
|
WORKDIR ${PWD}
|
||||||
|
ADD go.* ${PWD}
|
||||||
|
ADD . ${PWD}
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION} AS protos-base
|
||||||
ARG TARGET_OS=unknown
|
ARG TARGET_OS=unknown
|
||||||
ARG TARGET_ARCH=unknown
|
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 apt-get update && apt-get install --no-install-recommends -y \
|
||||||
make \
|
|
||||||
git \
|
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
libprotobuf-dev
|
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 gotest.tools/gotestsum@v0.4.2 && \
|
|
||||||
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0
|
|
||||||
|
|
||||||
WORKDIR ${PWD}
|
WORKDIR ${PWD}
|
||||||
ADD go.* ${PWD}
|
ADD go.* ${PWD}
|
||||||
RUN go mod download
|
|
||||||
ADD . ${PWD}
|
ADD . ${PWD}
|
||||||
|
|
||||||
FROM fs AS make-protos
|
FROM golang:${GO_VERSION} AS lint-base
|
||||||
|
RUN go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0
|
||||||
|
|
||||||
|
FROM protos-base AS make-protos
|
||||||
RUN make -f builder.Makefile protos
|
RUN make -f builder.Makefile protos
|
||||||
|
|
||||||
FROM fs AS make-cli
|
FROM base AS make-cli
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
GOOS=${TARGET_OS} \
|
GOOS=${TARGET_OS} \
|
||||||
GOARCH=${TARGET_ARCH} \
|
GOARCH=${TARGET_ARCH} \
|
||||||
make -f builder.Makefile cli
|
make -f builder.Makefile cli
|
||||||
|
|
||||||
FROM fs AS make-cross
|
FROM base AS make-cross
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
make -f builder.Makefile cross
|
make -f builder.Makefile cross
|
||||||
|
|
||||||
|
@ -45,8 +54,8 @@ COPY --from=make-cli /api/bin/* .
|
||||||
FROM scratch AS cross
|
FROM scratch AS cross
|
||||||
COPY --from=make-cross /api/bin/* .
|
COPY --from=make-cross /api/bin/* .
|
||||||
|
|
||||||
FROM fs as test
|
FROM base as test
|
||||||
RUN make -f builder.Makefile test
|
RUN make -f builder.Makefile test
|
||||||
|
|
||||||
FROM fs AS lint
|
FROM lint-base AS lint
|
||||||
RUN make -f builder.Makefile lint
|
RUN make -f builder.Makefile lint
|
||||||
|
|
|
@ -55,12 +55,11 @@ cross:
|
||||||
@GOOS=windows GOARCH=amd64 $(GO_BUILD) -o $(BINARY)-windows-amd64.exe ./cli
|
@GOOS=windows GOARCH=amd64 $(GO_BUILD) -o $(BINARY)-windows-amd64.exe ./cli
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@gotestsum ./...
|
@go test ./...
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
golangci-lint run --timeout 10m0s ./...
|
golangci-lint run --timeout 10m0s ./...
|
||||||
|
|
||||||
|
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
.PHONY: all protos cli cross test lint
|
.PHONY: all protos cli cross test lint
|
||||||
|
|
|
@ -105,6 +105,11 @@ func New(opts ...Opt) (Store, error) {
|
||||||
s := &store{
|
s := &store{
|
||||||
root: filepath.Join(home, ".docker"),
|
root: filepath.Join(home, ".docker"),
|
||||||
}
|
}
|
||||||
|
if _, err := os.Stat(s.root); os.IsNotExist(err) {
|
||||||
|
if err = os.Mkdir(s.root, 0755); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(s)
|
opt(s)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue