Skip to content

Commit

Permalink
Downgrade confluent-kafka-go to v2.0.2 due to confluentinc/confluent-…
Browse files Browse the repository at this point in the history
  • Loading branch information
everesio committed Apr 10, 2023
1 parent 6f59f1d commit da70336
Show file tree
Hide file tree
Showing 36 changed files with 532 additions and 3,005 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM golang:1.20-alpine3.16 as builder
FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.17 as builder

RUN apk add alpine-sdk ca-certificates

ARG TARGETOS
ARG TARGETARCH

WORKDIR "/code"
ADD . "/code"

# 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.
RUN make BINARY=mqtt-proxy BUILD_FLAGS="-tags musl" GOOS=linux GOARCH=amd64 build
RUN make BINARY=mqtt-proxy BUILD_FLAGS="-tags musl" GOOS=${TARGETOS} GOARCH=${TARGETARCH} build

FROM alpine:3.16
FROM --platform=$BUILDPLATFORM alpine:3.17
RUN apk add ca-certificates
COPY --from=builder /code/mqtt-proxy /mqtt-proxy
ENTRYPOINT ["/mqtt-proxy"]
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ LDFLAGS ?= -w -s \
-X github.com/prometheus/common/version.BuildUser=$$USER \
-X github.com/prometheus/common/version.BuildDate=${BUILD_DATE}

GOARCH ?= amd64
GOOS ?= linux
GOOS ?= $(if $(TARGETOS),$(TARGETOS),linux)
GOARCH ?= $(if $(TARGETARCH),$(TARGETARCH),amd64)
BUILDPLATFORM ?= $(GOOS)/$(GOARCH)

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

.PHONY: docker-build
docker-build:
docker build -f Dockerfile -t $(LOCAL_IMAGE) .
docker buildx build --build-arg BUILDPLATFORM=$(BUILDPLATFORM) --build-arg TARGETARCH=$(GOARCH) -f Dockerfile -t $(LOCAL_IMAGE) .

.PHONY: docker-push
docker-push:
docker build -f Dockerfile -t $(LOCAL_IMAGE) .
docker buildx build --build-arg BUILDPLATFORM=$(BUILDPLATFORM) --build-arg TARGETARCH=$(GOARCH) -t $(LOCAL_IMAGE) .
docker tag $(LOCAL_IMAGE) $(CLOUD_IMAGE)
docker push $(CLOUD_IMAGE)

Expand Down
2 changes: 2 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/oklog/run"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/common/version"
)

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

err := cfg.Validate()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/alecthomas/kong v0.7.0
github.com/alecthomas/kong-yaml v0.1.1
github.com/confluentinc/confluent-kafka-go/v2 v2.1.0
github.com/confluentinc/confluent-kafka-go/v2 v2.0.2
github.com/go-playground/validator/v10 v10.11.1
github.com/oklog/run v1.1.0
github.com/prometheus/client_golang v1.13.1
Expand Down
1,927 changes: 20 additions & 1,907 deletions go.sum

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit da70336

Please sign in to comment.