-
Notifications
You must be signed in to change notification settings - Fork 71
/
Makefile
45 lines (31 loc) · 1.27 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
project_name = boilerPlate
image_name = gofiber:latest
help: ## This help dialog.
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
run-local: ## Run the app locally
go run app.go
requirements: ## Generate go.mod & go.sum files
go mod tidy
clean-packages: ## Clean packages
go clean -modcache
up: ## Run the project in a local container
make up-silent
make shell
build: ## Generate docker image
docker build -t $(image_name) .
build-no-cache: ## Generate docker image with no cache
docker build --no-cache -t $(image_name) .
up-silent: ## Run local container in background
make delete-container-if-exist
docker run -d -p 3000:3000 --name $(project_name) $(image_name) ./app
up-silent-prefork: ## Run local container in background with prefork
make delete-container-if-exist
docker run -d -p 3000:3000 --name $(project_name) $(image_name) ./app -prod
delete-container-if-exist: ## Delete container if it exists
docker stop $(project_name) || true && docker rm $(project_name) || true
shell: ## Run interactive shell in the container
docker exec -it $(project_name) /bin/sh
stop: ## Stop the container
docker stop $(project_name)
start: ## Start the container
docker start $(project_name)