-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (32 loc) · 1.32 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
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)
## Live reload:
watch-prepare: ## Install the tools required for the watch command
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh
watch: ## Run the service with hot reload
bin/air
## Build:
build: ## Build the service
go build -o field-service
## Docker:
docker-compose: ## Start the service in docker
docker-compose up -d --build --force-recreate
docker-build: ## Build the Docker image with a specified tag
@echo "$(CYAN)Building Docker image...$(RESET)"
@if [ -z "$(tag)" ]; then \
echo "$(YELLOW)Error: Please specify the 'tag' parameter, e.g., make docker-build tag=1.0.0$(RESET)"; \
exit 1; \
fi
docker build --platform linux/amd64 -t sikoding20/field-service:$(tag) .
@echo "$(GREEN)Docker image built with tag '$(tag)'$(RESET)"
docker-push: ## Build the Docker image with a specified tag
@echo "$(CYAN)Building Docker image...$(RESET)"
@if [ -z "$(tag)" ]; then \
echo "$(YELLOW)Error: Please specify the 'tag' parameter, e.g., make docker-push tag=1.0.0$(RESET)"; \
exit 1; \
fi
docker push sikoding20/field-service:$(tag)
@echo "$(GREEN)Docker image built with tag '$(tag)'$(RESET)"