-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 954 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (34 loc) · 954 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
BINARY=customers-server
GOLANGCI_LINT_VERSION=v1.64.8
GORM_CLI_VERSION=v0.2.4
.PHONY: fmt lint gorm-gen run-db run-server run-server-docker integration-test run-compose clean
fmt:
go fmt ./...
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) \
run
gorm-gen:
go run gorm.io/cli/gorm@$(GORM_CLI_VERSION) gen -i ./internal/storage -o ./internal/storage/generated
run-db:
docker run --rm --name customers-db \
-p 3306:3306 \
-e MYSQL_DATABASE=customers \
-e MYSQL_USER=customers \
-e MYSQL_PASSWORD=customers \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
mariadb:12.2.2
run-server:
go run ./cmd/customers-server
run-server-docker:
docker build -t $(BINARY) .
docker run --rm --name $(BINARY) \
-p 8080:8080 \
-e DB_HOST=host.docker.internal \
$(BINARY)
integration-test:
go test -race -v ./integration_test.go
run-compose:
mkdir -p .data
podman-compose up --build
clean:
rm -rf .data