Pramit Pakhira
Pramit Pakhira

Reputation: 195

golang:1.19-alpine does not pull latest librdkafka package

I have Kafka consumer Golang application. I'm trying to deploy it in PKS cluster. Here is the docker file that I have defined,


FROM golang:1.19-alpine as c-bindings

RUN apk update && apk upgrade && apk add pkgconf git bash build-base sudo


FROM c-bindings as app-builder

WORKDIR /go/app


COPY . .

RUN go mod download
RUN go mod verify


RUN apk add librdkafka-dev pkgconf


RUN go build -race -tags dynamic --ldflags "-extldflags -static -s -w" -o main ./main.go

FROM scratch AS app-runner

WORKDIR /go/app/

COPY --from=app-builder /go/app/main ./main


CMD ["/go/app/main"]

I need GSSAPI as the SASL mechanism, hence added this in the docker (above),

RUN apk add librdkafka-dev pkgconf

However, while building the image it ends giving below error,

ERROR [app-builder 6/6] RUN go build -race -tags dynamic --ldflags "-extldflags -static -s -w" -o main ./main.go                                                                                                                                    9.9s
------ [app-builder 6/6] RUN go build -race -tags dynamic --ldflags "-extldflags -static -s -w" -o main ./main.go:
#13 4.598 # github.com/confluentinc/confluent-kafka-go/kafka
#13 4.598 ../pkg/mod/github.com/confluentinc/[email protected]/kafka/00version.go:44:2: error: #error "confluent-kafka-go requires librdkafka v1.9.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html"
#13 4.598    44 | #error "confluent-kafka-go requires librdkafka v1.9.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html"
#13 4.598       |  ^~~~~
------ executor failed running [/bin/sh -c go build -race -tags dynamic --ldflags "-extldflags -static -s -w" -o main ./main.go]: exit code: 2

Apparently

RUN apk add librdkafka-dev pkgconf 

is not able to pull the latest version of librdkafka for the golang:1.19-alpine base. Am I missing something here?

Upvotes: 1

Views: 1049

Answers (0)

Related Questions