|
@@ -1,11 +1,27 @@
|
|
|
-clean:
|
|
|
|
|
- rm -rf dist/
|
|
|
|
|
|
|
+GOOS ?= $(shell go env GOOS)
|
|
|
|
|
+GOARCH ?= $(shell go env GOARCH)
|
|
|
|
|
+PWD = $(shell pwd)
|
|
|
|
|
+
|
|
|
|
|
+export DOCKER_BUILDKIT=1
|
|
|
|
|
+
|
|
|
|
|
+.DEFAULT_GOAL := build
|
|
|
|
|
|
|
|
-build:
|
|
|
|
|
- go build -v -o dist/docker-ecs cmd/main/main.go
|
|
|
|
|
|
|
+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
|
|
|
- go test ./... -v
|
|
|
|
|
|
|
+ @docker build . \
|
|
|
|
|
+ --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
|
|
@@ -15,6 +31,13 @@ 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
|
|
|
- golangci-lint run --config ./golangci.yaml ./...
|
|
|
|
|
|
|
+ @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/
|
|
|
|
|
|
|
|
-.PHONY: clean build test dev lint e2e
|
|
|
|
|
|
|
+.PHONY: clean build test dev lint e2e cross
|