Makefile 957 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. PLATFORM?=local
  2. PWD=$(shell pwd)
  3. export DOCKER_BUILDKIT=1
  4. COMMIT := $(shell git rev-parse --short HEAD)
  5. TAG := $(shell git describe --tags --dirty --match "v*")
  6. .DEFAULT_GOAL := build
  7. build: ## Build for the current
  8. @docker build . \
  9. --output ./dist \
  10. --platform ${PLATFORM} \
  11. --build-arg COMMIT=${COMMIT} \
  12. --build-arg TAG=${TAG} \
  13. --target build
  14. cross: ## Cross build for linux, macos and windows
  15. @docker build . \
  16. --output ./dist \
  17. --build-arg COMMIT=${COMMIT} \
  18. --build-arg TAG=${TAG} \
  19. --target cross
  20. test: build ## Run tests
  21. @docker build . \
  22. --build-arg COMMIT=${COMMIT} \
  23. --build-arg TAG=${TAG} \
  24. --target test
  25. e2e: build ## Run tests
  26. go test ./... -v -tags=e2e
  27. dev: build
  28. @mkdir -p ~/.docker/cli-plugins/
  29. ln -f -s "${PWD}/dist/docker-ecs" "${HOME}/.docker/cli-plugins/docker-ecs"
  30. lint: ## Verify Go files
  31. @docker build . --target lint
  32. clean:
  33. rm -rf dist/
  34. .PHONY: clean build test dev lint e2e cross