Makefile 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. GOOS ?= $(shell go env GOOS)
  2. GOARCH ?= $(shell go env GOARCH)
  3. PWD = $(shell pwd)
  4. export DOCKER_BUILDKIT=1
  5. .DEFAULT_GOAL := build
  6. build: ## Build for the current
  7. @docker build . \
  8. --output type=local,dest=./dist \
  9. --build-arg TARGET_OS=${GOOS} \
  10. --build-arg TARGET_ARCH=${GOARCH} \
  11. --target build
  12. cross: ## Cross build for linux, macos and windows
  13. @docker build . \
  14. --output type=local,dest=./dist \
  15. --target cross
  16. test: build ## Run tests
  17. @docker build . \
  18. --output type=local,dest=./dist \
  19. --target test
  20. e2e: build ## Run tests
  21. go test ./... -v -tags=e2e
  22. dev: build
  23. @mkdir -p ~/.docker/cli-plugins/
  24. ln -f -s "${PWD}/dist/docker-ecs" "${HOME}/.docker/cli-plugins/docker-ecs"
  25. lint: ## Verify Go files
  26. @docker run --rm -t \
  27. -v $(PWD):/app \
  28. -w /app \
  29. golangci/golangci-lint:v1.27-alpine \
  30. golangci-lint run --timeout 10m0s --config ./golangci.yaml ./...
  31. clean:
  32. rm -rf dist/
  33. .PHONY: clean build test dev lint e2e cross