Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright 2020 The 2020 Docker, Inc.
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. export DOCKER_BUILDKIT=1
  12. UNAME_S := $(shell uname -s)
  13. ifeq ($(UNAME_S),Linux)
  14. MOBY_DOCKER=/usr/bin/docker
  15. endif
  16. ifeq ($(UNAME_S),Darwin)
  17. MOBY_DOCKER=/Applications/Docker.app/Contents/Resources/bin/docker
  18. endif
  19. all: cli
  20. protos: ## Generate go code from .proto files
  21. @docker build . --target protos \
  22. --output ./protos
  23. cli: ## Compile the cli
  24. @docker build . --target cli \
  25. --platform local \
  26. --build-arg BUILD_TAGS=example,local \
  27. --output ./bin
  28. e2e-local: ## Run End to end local tests
  29. go test -v ./tests/e2e ./tests/skip-win-ci-e2e ./local/e2e
  30. e2e-win-ci: ## Run End to end local tests on windows CI, no docker for linux containers available ATM
  31. go test -v ./tests/e2e
  32. e2e-aci: ## Run End to end ACI tests (requires azure login)
  33. go test -v ./tests/aci-e2e
  34. cross: ## Compile the CLI for linux, darwin and windows
  35. @docker build . --target cross \
  36. --build-arg BUILD_TAGS \
  37. --output ./bin \
  38. test: ## Run unit tests
  39. @docker build . \
  40. --build-arg BUILD_TAGS=example,local \
  41. --target test
  42. cache-clear: ## Clear the builder cache
  43. @docker builder prune --force --filter type=exec.cachemount --filter=unused-for=24h
  44. lint: ## run linter(s)
  45. @docker build . --target lint
  46. serve: cli ## start server
  47. @./bin/docker serve --address unix:///tmp/backend.sock
  48. moby-cli-link: ## create com.docker.cli symlink if does not already exist
  49. ln -s $(MOBY_DOCKER) /usr/local/bin/com.docker.cli
  50. help: ## Show help
  51. @echo Please specify a build target. The choices are:
  52. @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
  53. FORCE:
  54. .PHONY: all protos cli e2e-local cross test cache-clear lint serve classic-link help