Skip to content

Commit 8a0f2ca

Browse files
add Dockerfile (#38)
* add docker build file * add TLS support --------- Co-authored-by: Filipe Oliveira (Personal) <filipecosta.90@gmail.com>
1 parent be0cec4 commit 8a0f2ca

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:latest AS builder
2+
COPY . /
3+
WORKDIR /
4+
RUN make
5+
6+
FROM ubuntu:24.10
7+
LABEL Description="redis-benchmark-go"
8+
COPY --from=builder /redis-benchmark-go /usr/local/bin
9+
10+
ENTRYPOINT ["redis-benchmark-go"]
11+
CMD [ "--help" ]

redis-bechmark-go.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"context"
5-
tls "crypto/tls"
5+
"crypto/tls"
66
"flag"
77
"fmt"
88
"log"
@@ -185,6 +185,7 @@ func main() {
185185
username := flag.String("u", "", "Username for Redis Auth.")
186186
password := flag.String("a", "", "Password for Redis Auth.")
187187
enableTls := flag.Bool("tls", false, "Use TLS connection.")
188+
tlsSkipCertCheck := flag.Bool("tls-skip", false, "Ignore TLS certificate check")
188189
jsonOutFile := flag.String("json-out-file", "", "Results file. If empty will not save.")
189190
seed := flag.Int64("random-seed", 12345, "random seed to be used.")
190191
clients := flag.Uint64("c", 50, "number of clients.")
@@ -292,11 +293,12 @@ func main() {
292293
alwaysRESP2 = false
293294
}
294295
if *enableTls {
296+
conf := &tls.Config{
297+
InsecureSkipVerify: *tlsSkipCertCheck,
298+
}
295299
opts.NetDialer = &tls.Dialer{
296300
NetDialer: nil,
297-
Config: &tls.Config{
298-
ServerName: *host,
299-
},
301+
Config: conf,
300302
}
301303
}
302304

0 commit comments

Comments
 (0)