Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. VERSION="1.0.4"
  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. .assets.makefile:
  11. curl -fsSL -o $@ https://raw.githubusercontent.com/vladimirok5959/assets/main/assets.makefile
  12. include .assets.makefile
  13. test:
  14. go test `go list ./... \
  15. | grep -v cmd/ip2location \
  16. | grep -v internal/consts \
  17. | grep -v internal/server/web`
  18. debug: assets
  19. @-rm ./bin/ip2location
  20. make all
  21. ./bin/ip2location \
  22. -data_dir ${DATA_DIR} \
  23. -db_update_time 60 \
  24. -deployment development \
  25. -host 0.0.0.0 \
  26. -port 8080 \
  27. -web_url http://localhost:8080/ \
  28. color=always
  29. docker-test:
  30. docker run --rm \
  31. --network host \
  32. --name ${DOCKER_IMG_NAME}-test \
  33. -e ENV_DATA_DIR="/app/data" \
  34. -e ENV_DB_UPDATE_TIME="60" \
  35. -e ENV_DEPLOYMENT="deployment" \
  36. -e ENV_HOST="127.0.0.1" \
  37. -e ENV_PORT="8080" \
  38. -e ENV_WEB_URL="http://localhost:8080/" \
  39. -v /etc/timezone:/etc/timezone:ro \
  40. -v ${CURRENT_DIR}/data:/app/data \
  41. -it ${DOCKER_IMG_NAME}:latest