mirror of https://github.com/docker/compose.git
Revert "Refactor build process to build in containers"
This reverts commit adab0d1bdf7bf2cc242128aae7f5044bd5182ea1. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
2ab64ea10e
commit
4be3562450
|
@ -1,32 +0,0 @@
|
||||||
# syntax = docker/dockerfile:experimental
|
|
||||||
ARG GO_VERSION=1.14.2
|
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS base
|
|
||||||
ARG TARGET_OS=unknown
|
|
||||||
ARG TARGET_ARCH=unknown
|
|
||||||
ARG PWD=/ecs-plugin
|
|
||||||
ENV GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR ${PWD}
|
|
||||||
ADD go.* ${PWD}
|
|
||||||
RUN go mod download
|
|
||||||
ADD . ${PWD}
|
|
||||||
|
|
||||||
FROM base AS make-plugin
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
GOOS=${TARGET_OS} \
|
|
||||||
GOARCH=${TARGET_ARCH} \
|
|
||||||
make -f builder.Makefile build
|
|
||||||
|
|
||||||
FROM base AS make-cross
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
make -f builder.Makefile cross
|
|
||||||
|
|
||||||
FROM scratch AS build
|
|
||||||
COPY --from=make-plugin /ecs-plugin/dist/* .
|
|
||||||
|
|
||||||
FROM scratch AS cross
|
|
||||||
COPY --from=make-cross /ecs-plugin/dist/* .
|
|
||||||
|
|
||||||
FROM base as test
|
|
||||||
RUN make -f builder.Makefile test
|
|
37
ecs/Makefile
37
ecs/Makefile
|
@ -1,27 +1,11 @@
|
||||||
GOOS ?= $(shell go env GOOS)
|
clean:
|
||||||
GOARCH ?= $(shell go env GOARCH)
|
rm -rf dist/
|
||||||
PWD = $(shell pwd)
|
|
||||||
|
|
||||||
export DOCKER_BUILDKIT=1
|
build:
|
||||||
|
go build -v -o dist/docker-ecs cmd/main/main.go
|
||||||
.DEFAULT_GOAL := build
|
|
||||||
|
|
||||||
build: ## Build for the current
|
|
||||||
@docker build . \
|
|
||||||
--output type=local,dest=./dist \
|
|
||||||
--build-arg TARGET_OS=${GOOS} \
|
|
||||||
--build-arg TARGET_ARCH=${GOARCH} \
|
|
||||||
--target build
|
|
||||||
|
|
||||||
cross: ## Cross build for linux, macos and windows
|
|
||||||
@docker build . \
|
|
||||||
--output type=local,dest=./dist \
|
|
||||||
--target cross
|
|
||||||
|
|
||||||
test: build ## Run tests
|
test: build ## Run tests
|
||||||
@docker build . \
|
go test ./... -v
|
||||||
--output type=local,dest=./dist \
|
|
||||||
--target test
|
|
||||||
|
|
||||||
e2e: build ## Run tests
|
e2e: build ## Run tests
|
||||||
go test ./... -v -tags=e2e
|
go test ./... -v -tags=e2e
|
||||||
|
@ -31,13 +15,6 @@ dev: build
|
||||||
ln -f -s "${PWD}/dist/docker-ecs" "${HOME}/.docker/cli-plugins/docker-ecs"
|
ln -f -s "${PWD}/dist/docker-ecs" "${HOME}/.docker/cli-plugins/docker-ecs"
|
||||||
|
|
||||||
lint: ## Verify Go files
|
lint: ## Verify Go files
|
||||||
@docker run --rm -t \
|
golangci-lint run --config ./golangci.yaml ./...
|
||||||
-v $(PWD):/app \
|
|
||||||
-w /app \
|
|
||||||
golangci/golangci-lint:v1.27-alpine \
|
|
||||||
golangci-lint run --timeout 10m0s --config ./golangci.yaml ./...
|
|
||||||
|
|
||||||
clean:
|
.PHONY: clean build test dev lint e2e
|
||||||
rm -rf dist/
|
|
||||||
|
|
||||||
.PHONY: clean build test dev lint e2e cross
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
GOOS ?= $(shell go env GOOS)
|
|
||||||
GOARCH ?= $(shell go env GOARCH)
|
|
||||||
|
|
||||||
PROTOS=$(shell find . -name \*.proto)
|
|
||||||
|
|
||||||
EXTENSION :=
|
|
||||||
ifeq ($(GOOS),windows)
|
|
||||||
EXTENSION := .exe
|
|
||||||
endif
|
|
||||||
|
|
||||||
STATIC_FLAGS= CGO_ENABLED=0
|
|
||||||
LDFLAGS := "-s -w"
|
|
||||||
GO_BUILD = $(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
|
|
||||||
|
|
||||||
BINARY=dist/docker-ecs
|
|
||||||
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
|
|
||||||
|
|
||||||
export DOCKER_BUILDKIT=1
|
|
||||||
|
|
||||||
all: build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf dist/
|
|
||||||
|
|
||||||
build:
|
|
||||||
$(GO_BUILD) -v -o $(BINARY_WITH_EXTENSION) cmd/main/main.go
|
|
||||||
|
|
||||||
cross:
|
|
||||||
@GOOS=linux GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-linux-amd64 cmd/main/main.go
|
|
||||||
@GOOS=darwin GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-darwin-amd64 cmd/main/main.go
|
|
||||||
@GOOS=windows GOARCH=amd64 $(GO_BUILD) -v -o $(BINARY)-windows-amd64.exe cmd/main/main.go
|
|
||||||
|
|
||||||
test: build ## Run tests
|
|
||||||
@go test ./... -v
|
|
||||||
|
|
||||||
lint: ## Verify Go files
|
|
||||||
golangci-lint run --timeout 10m0s --config ./golangci.yaml ./...
|
|
||||||
|
|
||||||
.PHONY: clean build test dev lint e2e
|
|
Loading…
Reference in New Issue