-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
35 lines (27 loc) · 963 Bytes
/
Copy pathmakefile
File metadata and controls
35 lines (27 loc) · 963 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
PQ_CONTAINER = postgres
gen-proto: ## Generate protobuf files
@echo "Generating protobuf files..."
@mkdir -p proto-gen
protoc --go_out=proto-gen --go_opt=paths=source_relative \
--go-grpc_out=proto-gen --go-grpc_opt=paths=source_relative \
proto/translation/translation.proto proto/validation/validation.proto
gen-docs: ## Generate Swagger documentation
swag init -g api/server.go -o docs/
db-start: ## Start postgres server on a docker container
@docker run --rm --name $(PQ_CONTAINER) \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=postgres \
-p 5432:5432 \
-d \
postgres
db-stop: ## Stop the database container if running
@if [ ! "$(shell docker ps | grep '$(PQ_CONTAINER)' )" = "" ]; then \
docker stop postgres; \
fi
run-server: ## Run the server
@echo "Running server..."
go run ./cmd/main.go
run-all: db-stop sleep db-start sleep run-server ## Run the server with a database
sleep:
@sleep 5