2020-06-08 17:41:09 +02:00
|
|
|
GOOS ?= $(shell go env GOOS)
|
|
|
|
GOARCH ?= $(shell go env GOARCH)
|
|
|
|
PWD = $(shell pwd)
|
|
|
|
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := build
|
2020-04-24 14:19:14 +02:00
|
|
|
|
2020-06-08 17:41:09 +02:00
|
|
|
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
|
2020-04-14 08:40:52 +02:00
|
|
|
|
2020-05-05 23:33:54 +02:00
|
|
|
test: build ## Run tests
|
2020-06-08 17:41:09 +02:00
|
|
|
@docker build . \
|
|
|
|
--output type=local,dest=./dist \
|
|
|
|
--target test
|
2020-04-14 08:40:52 +02:00
|
|
|
|
2020-05-19 11:49:58 +02:00
|
|
|
e2e: build ## Run tests
|
|
|
|
go test ./... -v -tags=e2e
|
|
|
|
|
2020-04-14 08:40:52 +02:00
|
|
|
dev: build
|
2020-05-26 21:01:43 +02:00
|
|
|
@mkdir -p ~/.docker/cli-plugins/
|
2020-04-14 08:40:52 +02:00
|
|
|
ln -f -s "${PWD}/dist/docker-ecs" "${HOME}/.docker/cli-plugins/docker-ecs"
|
|
|
|
|
2020-04-28 10:47:03 +02:00
|
|
|
lint: ## Verify Go files
|
2020-06-08 17:41:09 +02:00
|
|
|
@docker run --rm -t \
|
|
|
|
-v $(PWD):/app \
|
|
|
|
-w /app \
|
|
|
|
golangci/golangci-lint:v1.27-alpine \
|
|
|
|
golangci-lint run --timeout 10m0s --config ./golangci.yaml ./...
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf dist/
|
2020-04-28 10:47:03 +02:00
|
|
|
|
2020-06-08 17:41:09 +02:00
|
|
|
.PHONY: clean build test dev lint e2e cross
|