2020-06-10 15:16:11 +02:00
|
|
|
PLATFORM?=local
|
|
|
|
PWD=$(shell pwd)
|
2020-06-10 15:07:25 +02:00
|
|
|
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
|
2020-06-30 11:37:03 +02:00
|
|
|
COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
TAG := $(shell git describe --tags --dirty --match "v*")
|
|
|
|
|
2020-06-10 15:07:25 +02:00
|
|
|
.DEFAULT_GOAL := build
|
2020-06-08 17:41:09 +02:00
|
|
|
|
2020-06-10 15:07:25 +02:00
|
|
|
build: ## Build for the current
|
|
|
|
@docker build . \
|
2020-06-10 15:16:11 +02:00
|
|
|
--output ./dist \
|
|
|
|
--platform ${PLATFORM} \
|
2020-06-30 11:37:03 +02:00
|
|
|
--build-arg COMMIT=${COMMIT} \
|
|
|
|
--build-arg TAG=${TAG} \
|
2020-06-10 15:07:25 +02:00
|
|
|
--target build
|
|
|
|
|
|
|
|
cross: ## Cross build for linux, macos and windows
|
|
|
|
@docker build . \
|
2020-06-10 15:16:11 +02:00
|
|
|
--output ./dist \
|
2020-06-30 11:37:03 +02:00
|
|
|
--build-arg COMMIT=${COMMIT} \
|
|
|
|
--build-arg TAG=${TAG} \
|
2020-06-10 15:07:25 +02:00
|
|
|
--target cross
|
2020-04-14 08:40:52 +02:00
|
|
|
|
2020-05-05 23:33:54 +02:00
|
|
|
test: build ## Run tests
|
2020-06-30 11:37:03 +02:00
|
|
|
@docker build . \
|
|
|
|
--build-arg COMMIT=${COMMIT} \
|
|
|
|
--build-arg TAG=${TAG} \
|
|
|
|
--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-10 15:16:11 +02:00
|
|
|
@docker build . --target lint
|
2020-06-10 15:07:25 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf dist/
|
2020-04-28 10:47:03 +02:00
|
|
|
|
2020-06-10 15:07:25 +02:00
|
|
|
.PHONY: clean build test dev lint e2e cross
|