-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 820 Bytes
/
Copy pathMakefile
File metadata and controls
56 lines (45 loc) · 820 Bytes
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
51
52
53
54
55
56
# Makefile
# Variables
DC = docker compose
GO = go
# Default target
.PHONY: all
all: build
# Build the app
.PHONY: build
build:
$(GO) build -o ./backend/app ./backend/cmd
# Run the project locally
.PHONY: run
run:
$(GO) run ./backend/cmd
# Start docker containers
.PHONY: up
up:
$(DC) up -d
# Stop docker containers
.PHONY: down
down:
$(DC) down
# View logs
.PHONY: logs
logs:
$(DC) logs -f
# Restart services
.PHONY: restart
restart:
$(DC) restart
# Clean up
.PHONY: clean
clean:
$(DC) down -v
rm -f ./backend/app
# Setup environment
.PHONY: setup
setup:
[ -f .env ] || cp .env-template .env
@echo "Please edit .env file with your configuration"
# Build and start everything
.PHONY: start
start: setup build up
@echo "Application started at http://localhost:$(shell grep PORT .env | cut -d= -f2)"