github.com/joao-fontenele/go-url-shortener@v1.3.4/makefile (about) 1 export UID := $(shell id -u) 2 3 .PHONY: build 4 build: 5 # maybe it's still necessary to install binaries (like air) in addition to run this target 6 docker-compose build 7 docker-compose run --rm --no-deps app go mod download 8 9 .PHONY: cli 10 cli: 11 docker-compose run --rm --no-deps app sh 12 13 .PHONY: start 14 start: 15 docker-compose up -d 16 17 .PHONY: stop 18 stop: 19 docker-compose down 20 21 .PHONY: logs 22 logs: 23 docker logs -f --since 1h --tail 300 go-url-shortener 24 25 .PHONY: compile 26 compile: 27 CGO_ENABLED=0 \ 28 GO111MODULES=on \ 29 go build \ 30 -a \ 31 -o ./bin/server \ 32 -ldflags '-extldflags -static' \ 33 cmd/server.go 34 35 .PHONY: build-image 36 build-image: 37 docker build -t go-url-shortener:v0.0.0 . 38 39 .PHONY: init-db 40 init-db: 41 PGPASSWORD=root psql -h postgres -U root -a -f ./docker/postgres/init.sql 42 43 .PHONY: cli-db 44 cli-db: 45 docker-compose exec postgres psql -U gopher shortdb 46 47 .PHONY: test 48 test: 49 APP_ENV=test go test -v ./... 50 51 .PHONY: coverage 52 coverage: 53 rm -fr coverage 54 mkdir -p coverage 55 APP_ENV=test go test -coverprofile=./c.out ./... 56 go tool cover -html=./c.out -o coverage/coverage.html 57 58 ############## 59 ### Deploy ### 60 ############## 61 62 .PHONY: deploy 63 deploy: 64 heroku container:push web 65 heroku container:release web