Skip to content

Commit da70336

Browse files
committed
Downgrade confluent-kafka-go to v2.0.2 due to confluentinc/confluent-kafka-go#981
1 parent 6f59f1d commit da70336

36 files changed

+532
-3005
lines changed

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
FROM golang:1.20-alpine3.16 as builder
1+
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.17 as builder
22

33
RUN apk add alpine-sdk ca-certificates
44

5+
ARG TARGETOS
6+
ARG TARGETARCH
7+
58
WORKDIR "/code"
69
ADD . "/code"
710

811
# https://github.com/confluentinc/confluent-kafka-go: When building your application for Alpine Linux (musl libc) you must pass -tags musl to go get, go build, etc.
9-
RUN make BINARY=mqtt-proxy BUILD_FLAGS="-tags musl" GOOS=linux GOARCH=amd64 build
12+
RUN make BINARY=mqtt-proxy BUILD_FLAGS="-tags musl" GOOS=${TARGETOS} GOARCH=${TARGETARCH} build
1013

11-
FROM alpine:3.16
14+
FROM --platform=$BUILDPLATFORM alpine:3.17
1215
RUN apk add ca-certificates
1316
COPY --from=builder /code/mqtt-proxy /mqtt-proxy
1417
ENTRYPOINT ["/mqtt-proxy"]

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ LDFLAGS ?= -w -s \
1616
-X github.com/prometheus/common/version.BuildUser=$$USER \
1717
-X github.com/prometheus/common/version.BuildDate=${BUILD_DATE}
1818

19-
GOARCH ?= amd64
20-
GOOS ?= linux
19+
GOOS ?= $(if $(TARGETOS),$(TARGETOS),linux)
20+
GOARCH ?= $(if $(TARGETARCH),$(TARGETARCH),amd64)
21+
BUILDPLATFORM ?= $(GOOS)/$(GOARCH)
2122

2223
LOCAL_IMAGE ?= local/$(BINARY)
2324
CLOUD_IMAGE ?= grepplabs/mqtt-proxy:$(TAG)
@@ -61,11 +62,11 @@ os-build:
6162

6263
.PHONY: docker-build
6364
docker-build:
64-
docker build -f Dockerfile -t $(LOCAL_IMAGE) .
65+
docker buildx build --build-arg BUILDPLATFORM=$(BUILDPLATFORM) --build-arg TARGETARCH=$(GOARCH) -f Dockerfile -t $(LOCAL_IMAGE) .
6566

6667
.PHONY: docker-push
6768
docker-push:
68-
docker build -f Dockerfile -t $(LOCAL_IMAGE) .
69+
docker buildx build --build-arg BUILDPLATFORM=$(BUILDPLATFORM) --build-arg TARGETARCH=$(GOARCH) -t $(LOCAL_IMAGE) .
6970
docker tag $(LOCAL_IMAGE) $(CLOUD_IMAGE)
7071
docker push $(CLOUD_IMAGE)
7172

cmd/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/oklog/run"
2424
"github.com/prometheus/client_golang/prometheus"
2525
"github.com/prometheus/client_golang/prometheus/promauto"
26+
"github.com/prometheus/common/version"
2627
)
2728

2829
func runServer(
@@ -31,6 +32,7 @@ func runServer(
3132
registry *prometheus.Registry,
3233
cfg *config.Server,
3334
) error {
35+
logger.WithField("version", version.Version).WithField("branch", version.Branch).WithField("revision", version.Revision).Infof("starting mqtt-proxy")
3436

3537
err := cfg.Validate()
3638
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.20
55
require (
66
github.com/alecthomas/kong v0.7.0
77
github.com/alecthomas/kong-yaml v0.1.1
8-
github.com/confluentinc/confluent-kafka-go/v2 v2.1.0
8+
github.com/confluentinc/confluent-kafka-go/v2 v2.0.2
99
github.com/go-playground/validator/v10 v10.11.1
1010
github.com/oklog/run v1.1.0
1111
github.com/prometheus/client_golang v1.13.1

go.sum

Lines changed: 20 additions & 1907 deletions
Large diffs are not rendered by default.

vendor/github.com/confluentinc/confluent-kafka-go/v2/kafka/00version.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/confluentinc/confluent-kafka-go/v2/kafka/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)