-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (41 loc) · 890 Bytes
/
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
46
47
48
49
50
# Variables
DOCKER_COMPOSE_FILE = docker-compose.yml
APP_SERVICE = app
GO_CMD = go
DOCKER_COMPOSE_CMD = docker-compose
DOCKER_CMD = docker
# Build the Go application
.PHONY: build
build:
$(GO_CMD) build -o bin/app ./cmd/server
# Build the Go application image
.PHONY: image
image:
$(DOCKER_CMD) build -t image-service .
# Run the application with Docker Compose
.PHONY: up
up:
$(DOCKER_COMPOSE_CMD) up -d
# Stop the application
.PHONY: down
down:
$(DOCKER_COMPOSE_CMD) down
# Restart the application
.PHONY: restart
restart: down up
# Run tests
.PHONY: test
test:
$(GO_CMD) test ./...
# Clean up generated files
.PHONY: clean
clean:
rm -rf bin/
# View application logs
.PHONY: logs
logs:
$(DOCKER_COMPOSE_CMD) logs -f
# Remove Docker containers, networks, volumes, and images
.PHONY: down-clear
down-clear:
$(DOCKER_COMPOSE_CMD) down --volumes --rmi all --remove-orphans