Makefile 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. VERSION="1.0.0"
  2. DOCKER_IMG_NAME := golang-ip2location
  3. CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
  4. DATA_DIR := ${CURRENT_DIR}/data
  5. .PHONY: default
  6. default: test
  7. include .makefile/minimal.makefile
  8. include .makefile/build.makefile
  9. include .makefile/docker.makefile
  10. test:
  11. go test `go list ./... \
  12. | grep -v cmd/ip2location \
  13. | grep -v internal/consts \
  14. | grep -v internal/server/web`
  15. debug:
  16. @-rm ./bin/ip2location
  17. make all
  18. ./bin/ip2location \
  19. -data_dir ${DATA_DIR} \
  20. -deployment development \
  21. -host 0.0.0.0 \
  22. -port 8080 \
  23. -web_url http://localhost:8080/ \
  24. color=always
  25. docker-test:
  26. docker run --rm \
  27. --network host \
  28. --name ${DOCKER_IMG_NAME}-test \
  29. -e ENV_DATA_DIR="/app/data" \
  30. -e ENV_DEPLOYMENT="deployment" \
  31. -e ENV_HOST="127.0.0.1" \
  32. -e ENV_PORT="8080" \
  33. -e ENV_WEB_URL="http://localhost:8080/" \
  34. -v /etc/timezone:/etc/timezone:ro \
  35. -v ${CURRENT_DIR}/data:/app/data \
  36. -it ${DOCKER_IMG_NAME}:latest