-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 956 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
51
.PHONY: test run build clean wire
APP_NAME = apiserver
GO ?= GO111MODULE=on go
BUILD_DIR = $(PWD)/build
MAIN_FILE = ./application/cmd/main.go
SERVER_FILE = ./application/server.go
MIGRATION_DIR = $(PWD)/infrastructure/migrations
setup:
go mod tidy
go install github.com/google/wire/cmd/wire@latest
test:
go test ./...
# remove binary
clean:
echo "remove bin exe"
rm -rf $(BUILD_DIR)
# build binary
build:
CGO_ENABLED=0 $(GO) build -ldflags="-w -s" -o $(BUILD_DIR)/$(APP_NAME) $(MAIN_FILE)
swag:
swag init -g $(SERVER_FILE)
wire:
cd application && wire
# local run
local:
make swag
make wire
make build
$(BUILD_DIR)/$(APP_NAME)
docker.fiber.build:
make swag
make wire
docker build -t fiber .
docker.fiber.local:
make docker.fiber.build
docker run --rm -p 8080:8080 --name $(APP_NAME) --env-file ./.env.local fiber
docker.fiber:
make docker.fiber.build
docker run --rm -p 8080:8080 --name $(APP_NAME) --env PHASE=prod fiber