Skip to content

Commit 18f8291

Browse files
committed
Revamp
1 parent 4cde5c0 commit 18f8291

29 files changed

+2288
-1188
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
go.work
2222

2323
bin/
24-
build/
24+
build/
25+
26+
.DS_Store

.golangci.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ linters:
2121
disable-all: true
2222
enable:
2323
- bodyclose
24-
- deadcode
2524
- depguard
2625
- dogsled
2726
- dupl
@@ -32,7 +31,6 @@ linters:
3231
- gocritic
3332
- gofmt
3433
- goimports
35-
- gomnd
3634
- gocyclo
3735
- gosec
3836
- gosimple
@@ -45,16 +43,16 @@ linters:
4543
- predeclared
4644
- revive
4745
- staticcheck
48-
- structcheck
4946
- stylecheck
5047
- thelper
5148
- tparallel
5249
- typecheck
5350
- unconvert
5451
- unparam
55-
- varcheck
52+
- unused
5653
- whitespace
5754
- wsl
5855

5956
run:
57+
go: "1.20"
6058
issues-exit-code: 1

Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM golang:1.20-alpine AS builder
2+
3+
WORKDIR /app
4+
5+
COPY go.* ./
6+
7+
RUN go mod download
8+
9+
COPY ./ ./
10+
11+
RUN GOOS=linux \
12+
GOARCH=amd64 \
13+
CGO_ENABLED=0 \
14+
go build -ldflags "-s -w" -o bin/api-gateway-srv-linux-amd64 main.go
15+
16+
# ---
17+
18+
FROM gcr.io/distroless/static:nonroot
19+
20+
COPY --from=builder /app/bin/api-gateway-srv-linux-amd64 /
21+
22+
EXPOSE 8080 9090
23+
24+
CMD ["/api-gateway-srv-linux-amd64"]

Makefile

+17-12
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,41 @@ OK_COLOR=\033[32;01m
33
ERROR_COLOR=\033[31;01m
44
WARN_COLOR=\033[33;01m
55

6-
SERVICE_NAME=api-gateway
6+
SERVICE_NAME=api-gateway-srv
77

8-
.PHONY: all format lint lint-chart build
9-
all: format lint lint-chart build
8+
.PHONY: all format build
9+
all: format build
1010

1111
run:
1212
@go run main.go
1313

14-
build:
14+
build: test
1515
@echo "$(OK_COLOR)==> Building $(SERVICE_NAME)...$(NO_COLOR)"
1616
@go build -o bin/$(SERVICE_NAME) main.go
1717

1818
compile:
1919
@echo "$(OK_COLOR)==> Compiling $(SERVICE_NAME) for Linux x86-64...$(NO_COLOR)"
20-
@GOOS=linux GOARCH=amd64 go build -o bin/$(SERVICE_NAME)-linux-amd64 main.go
20+
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o bin/$(SERVICE_NAME)-linux-amd64 main.go
2121

22-
format:
23-
@echo "$(OK_COLOR)==> Formatting $(SERVICE_NAME)...$(NO_COLOR)"
24-
@go fmt
22+
test: lint
23+
@echo "$(OK_COLOR)==> Testing $(SERVICE_NAME)...$(NO_COLOR)"
24+
@go test
2525

26-
lint:
26+
lint:
2727
@echo "$(OK_COLOR)==> Linting $(SERVICE_NAME)...$(NO_COLOR)"
2828
@golangci-lint run
2929

30+
format:
31+
@echo "$(OK_COLOR)==> Formatting $(SERVICE_NAME)...$(NO_COLOR)"
32+
@go fmt
33+
3034
# Helm
3135

3236
lint-chart:
3337
@echo "$(OK_COLOR)==> Linting helm chart of $(SERVICE_NAME)... $(NO_COLOR)"
34-
@helm lint -f ./chart/values.yaml -f ./chart/values-prod.yaml ./chart
35-
38+
@helm lint -f ./chart/values.yaml -f ./chart/values-develop.yaml ./chart
39+
@helm lint -f ./chart/values.yaml -f ./chart/values-production.yaml ./chart
40+
3641
render-chart:
3742
@echo "$(OK_COLOR)==> Rendering helm chart of $(SERVICE_NAME)... $(NO_COLOR)"
38-
@helm template --output-dir=.chart.rendered -f ./chart/values.yaml -f ./chart/values-prod.yaml ./chart
43+
@helm template --output-dir=.chart.rendered -f ./chart/values.yaml -f ./chart/values-develop.yaml api-gateway-srv ./chart

app/authentication/config.go

-30
This file was deleted.

0 commit comments

Comments
 (0)