Skip to content

Commit eb40d09

Browse files
committed
Add Dockerfile, fix default cli args.
1 parent cc657ae commit eb40d09

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.git*
21
.vscode
32
readme*
43
README*

Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM golang:1.22-alpine AS build
2+
3+
RUN apk add --no-cache --no-progress git make
4+
5+
WORKDIR /app
6+
COPY . .
7+
RUN make build-only
8+
9+
FROM alpine:3 AS runtime
10+
11+
WORKDIR /app
12+
COPY --from=build /app/grpc-rest-proxy .
13+
14+
EXPOSE 8080
15+
16+
ENTRYPOINT ["/app/grpc-rest-proxy"]

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ spec:
130130
- name: grpc-port
131131
containerPort: 50051
132132
# gateway that will connnect to service
133-
- name: grpc-gateway-service
134-
image: "grpc-gateway:latest" # provider your own image
133+
- name: grpc-rest-proxy
134+
image: "grpc-rest-proxy:latest" # provider your own image
135135
command:
136-
- "/app/grpc-gateway"
136+
- "/app/grpc-rest-proxy"
137137
args:
138138
- "--gateways.grpc.client.targetAddr=127.0.0.1:50051"
139139
ports:

cmd/service/main.go

+13-11
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ import (
1919
)
2020

2121
const (
22-
defaultRequestTimeout = 5 * time.Second
23-
defaultReadTimeout = 10 * time.Second
24-
descriptorTimeout = time.Minute
25-
maxRequestSize = 10024
26-
httpServerAddr = "0.0.0.0:8080"
27-
reflectionServiceName = "grpc.reflection.v1.ServerReflection/ServerReflectionInfo"
28-
excludedDescriptors = "grpc.health.v1.Health,grpc.reflection.v1.ServerReflection"
29-
grpcServerAddr = "0.0.0.0:50051"
30-
tls = false
31-
tlsSkipverify = false
22+
defaultRequestTimeout = 5 * time.Second
23+
defaultReadTimeout = 10 * time.Second
24+
descriptorTimeout = time.Minute
25+
maxRequestSize = 10024
26+
httpServerAddr = "0.0.0.0:8080"
27+
defaultDescriptorsFetchingType = "remote"
28+
reflectionServiceName = "grpc.reflection.v1.ServerReflection/ServerReflectionInfo"
29+
excludedDescriptors = "grpc.health.v1.Health,grpc.reflection.v1.ServerReflection"
30+
grpcServerAddr = "0.0.0.0:50051"
31+
tls = false
32+
tlsSkipverify = false
3233
)
3334

3435
var (
@@ -47,6 +48,7 @@ func main() {
4748
pflag.Duration("transport.http.server.readTimeout", defaultReadTimeout, "read timeout")
4849
pflag.Duration("transport.http.server.readHeaderTimeout", defaultRequestTimeout, "read header timeout")
4950

51+
pflag.String("descriptors.kind", defaultDescriptorsFetchingType, "type of descriptors fetching")
5052
pflag.Duration("descriptors.remote.timeout", descriptorTimeout, "request timeout for remote descriptors")
5153
pflag.String("descriptors.remote.reflectionServiceName", reflectionServiceName, "reflection service name")
5254
pflag.StringArray("descriptors.remote.exclude", strings.Split(excludedDescriptors, ","), "remote descriptors to exclude")
@@ -79,7 +81,7 @@ func main() {
7981
os.Exit(1)
8082
}
8183

82-
if configFile != nil {
84+
if configFile != nil && *configFile != "" {
8385
err := loadConfigFromFile(*configFile, conf)
8486
if err != nil {
8587
logging.Error(jErrors.Details(jErrors.Trace(err)))

0 commit comments

Comments
 (0)