File tree Expand file tree Collapse file tree 3 files changed +52
-12
lines changed
kubernetes/examples/production Expand file tree Collapse file tree 3 files changed +52
-12
lines changed Original file line number Diff line number Diff line change 99 - " v*"
1010 release :
1111 types : [created]
12+ pull_request :
13+ branches :
14+ - main
15+ - development
1216
1317env :
1418 REGISTRY : ghcr.io
1519 IMAGE_NAME : ${{ github.repository }}
1620
1721jobs :
22+ test :
23+ strategy :
24+ matrix :
25+ os : [ubuntu-latest, macos-latest]
26+ go-version : ["1.23.4"]
27+ runs-on : ${{ matrix.os }}
28+ steps :
29+ - name : Checkout repository
30+ uses : actions/checkout@v4
31+
32+ - name : Set up Go
33+ uses : actions/setup-go@v4
34+ with :
35+ go-version : ${{ matrix.go-version }}
36+
37+ - name : Cache Go modules
38+ uses : actions/cache@v4
39+ with :
40+ path : |
41+ ~/.cache/go-build
42+ ~/go/pkg/mod
43+ key : ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
44+ restore-keys : |
45+ ${{ runner.os }}-go-${{ matrix.go-version }}-
46+
47+ - name : Run tests
48+ run : go test -v ./...
49+
50+ - name : Build binary for ${{ matrix.os }}
51+ run : CGO_ENABLED=0 go build -o xdatabase-proxy cmd/proxy/main.go
52+
1853 build-and-push :
54+ needs : test
1955 runs-on : ubuntu-latest
2056 if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
2157 permissions :
3167 with :
3268 go-version : " 1.23.4"
3369
34- - name : Run tests
35- run : go test -v ./...
36-
3770 - name : Log in to the Container registry
3871 uses : docker/login-action@v3
3972 with :
67100 platforms : linux/amd64,linux/arm64,linux/386
68101
69102 build-and-push-development :
103+ needs : test
70104 runs-on : ubuntu-latest
71105 if : github.ref == 'refs/heads/development'
72106 permissions :
82116 with :
83117 go-version : " 1.23.4"
84118
85- - name : Run tests
86- run : go test -v ./...
87-
88119 - name : Log in to the Container registry
89120 uses : docker/login-action@v3
90121 with :
Original file line number Diff line number Diff line change 1+ # Build stage
12FROM golang:1.23.4-alpine as builder
23
34WORKDIR /app
45
56COPY . .
67
78RUN go mod download
8- RUN CGO_ENABLED=0 go build -o main cmd/proxy/main.go
9+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main cmd/proxy/main.go
910
11+ # Runtime stage
1012FROM alpine:latest as runner
1113
1214WORKDIR /app
1315
16+ RUN apk add --no-cache ca-certificates tzdata
17+
1418COPY --from=builder /app/main /app/main
1519
20+ EXPOSE 5432
21+
22+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
23+ CMD test -f /app/main || exit 1
24+
1625CMD ["./main" ]
Original file line number Diff line number Diff line change 7575 image : ghcr.io/hasirciogluhq/xdatabase-proxy:latest
7676 imagePullPolicy : Always
7777 ports :
78- - containerPort : 5432
79- hostPort : 5432
78+ - containerPort : 4545
79+ hostPort : 4545
8080 name : proxy-port
8181 env :
8282 - name : MODE
8686 - name : NAMESPACE
8787 value : xdatabase-proxy
8888 - name : POSTGRESQL_PROXY_START_PORT
89- value : " 5432 "
89+ value : " 4545 "
9090 resources :
9191 requests :
9292 cpu : 100m
9797 livenessProbe :
9898 httpGet :
9999 path : /healthz
100- port : 80
100+ port : 8080
101101 scheme : HTTP
102102 initialDelaySeconds : 15
103103 periodSeconds : 20
@@ -107,7 +107,7 @@ spec:
107107 readinessProbe :
108108 httpGet :
109109 path : /ready
110- port : 80
110+ port : 8080
111111 scheme : HTTP
112112 initialDelaySeconds : 5
113113 periodSeconds : 10
You can’t perform that action at this time.
0 commit comments