Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. VERSION="1.0.2"
  2. default: debug test run
  3. debug:
  4. go vet ./...
  5. gofmt -d ./
  6. gofmt -w ./
  7. go build -mod vendor -o ./fave
  8. test:
  9. go test ./...
  10. run:
  11. @./fave -host 0.0.0.0 -port 8080 -dir ./hosts -debug true -keepalive false
  12. build: clean
  13. @-mkdir ./bin
  14. @cd ./bin
  15. @cd ..
  16. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.linux-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  17. CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.darwin-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  18. CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.windows-amd64.exe -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  19. cd ./bin && find . -name 'fave*' | xargs -I{} tar czf {}.tar.gz {}
  20. @cp -R ./hosts/localhost ./bin/localhost
  21. @-find ./bin/localhost -type f -name '.*' -exec rm -f {} \;
  22. @-find ./bin/localhost -type f -name '*.json' -exec rm -f {} \;
  23. @-rm ./bin/localhost/tmp/*
  24. cd ./bin && tar -zcf localhost.tar.gz ./localhost
  25. @-rm -r ./bin/localhost
  26. cp ./Dockerfile ./bin/Dockerfile
  27. cd ./bin && shasum -a 256 * > sha256sum.txt
  28. cat ./bin/sha256sum.txt
  29. clean:
  30. @-rm -r ./bin
  31. format:
  32. gofmt -w ./
  33. update:
  34. go mod vendor
  35. go mod download
  36. docker-test:
  37. @-docker stop fave-test
  38. @-docker rm fave-test
  39. @-docker rmi fave
  40. docker build --rm=false --force-rm=true -t fave .
  41. docker run -d --name fave-test --cpus=".2" -m 200m -p 8080:8080 -t -i fave:latest /app/fave.linux-amd64
  42. docker-img:
  43. docker build -t fave .
  44. docker-clr:
  45. @-docker stop fave-test
  46. @-docker rm fave-test
  47. @-docker rmi fave
  48. cy-dev:
  49. yarn cypress open
  50. cy:
  51. yarn cypress run
  52. ab:
  53. ab -kc 10 -t 120 http://localhost:8080/