Skip to content

Commit

Permalink
Cut v0.0.50 release
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Kalashnykov <AndriyKalashnykov@gmail.com>
  • Loading branch information
AndriyKalashnykov committed Oct 27, 2023
1 parent 3b34a23 commit bde23a7
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ jobs:
with:
context: .
file: ./Dockerfile.consumer
platforms: linux/arm64
platforms: linux/amd64
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Output container image digest
run: echo ${{ steps.docker_build.outputs.digest }}
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# docker buildx build --build-arg TARGETARCH=arm64 --platform linux/arm64 --file Dockerfile -t kafka-confluent-go-consumer:latest .

FROM --platform=linux/$TARGETARCH golang:1.21.3-alpine as builder

ARG TARGETARCH
RUN echo $TARGETARCH

# librdkafka package for alpine yet
# https://pkgs.alpinelinux.org/packages?name=librdkafka-dev&branch=edge&repo=&arch=&maintainer=John%20Anthony
RUN apk add musl-dev librdkafka-dev ca-certificates git gcc g++ libtool libc-dev pkgconf
RUN apk add build-base coreutils make musl-dev rpm wget curl cyrus-sasl-dev libevent libsasl lz4-dev openssh openssl openssl-dev yajl-dev zlib-dev

ENV LIBRD_VER=2.3.0
# Install librdkafka $LIBRD_VER
# https://gist.github.com/jaihind213/e82d41dc79f52cfa64ca32350bdb27df
#RUN apk --no-cache add ca-certificates git gcc g++ libtool libc-dev musl-dev pkgconf
#RUN apk add build-base coreutils make musl-dev rpm wget curl cyrus-sasl-dev libevent libsasl lz4-dev openssh openssl openssl-dev yajl-dev zlib-dev

#RUN echo " ------> Install librdkafka..."
#RUN apk add --no-cache --virtual .make-deps bash make wget git gcc g++
#RUN apk add --no-cache musl-dev zlib-dev openssl zstd-dev pkgconfig libc-dev
#RUN wget /~https://github.com/edenhill/librdkafka/archive/v${LIBRD_VER}.tar.gz && tar -xvf v${LIBRD_VER}.tar.gz && cd librdkafka-${LIBRD_VER} && ./configure --prefix /usr && make && make install && make clean && rm -rf librdkafka-${LIBRD_VER} && rm -rf v${LIBRD_VER}.tar.gz && apk del .make-deps

#RUN apk add --no-cache --virtual .make-deps bash make wget git gcc g++ && apk add --no-cache musl-dev zlib-dev openssl zstd-dev pkgconfig libc-dev
#RUN wget /~https://github.com/edenhill/librdkafka/archive/v${LIBRD_VER}.tar.gz
#RUN tar -xvf v${LIBRD_VER}.tar.gz && cd librdkafka-${LIBRD_VER} && ./configure --prefix /usr && make && make install
#RUN export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
#ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/

WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH go build -tags musl --ldflags "-extldflags -static" -a -o consumer consumer/consumer.go

FROM alpine:3.18.4 as runtime
COPY --from=builder /app/consumer /
EXPOSE 8080
CMD ["/bin/sh", "-c", "/consumer"]
43 changes: 17 additions & 26 deletions Dockerfile.consumer
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
# docker buildx build --build-arg TARGETARCH=arm64 --file Dockerfile.consumer -t kafka-confluent-go-consumer:latest .
# docker buildx build --platform linux/arm64 --file Dockerfile.consumer -t kafka-confluent-go-consumer:latest .
FROM golang:1.21.3-alpine as builder

ENV LIBRD_VER=2.3.0

# librdkafka package for alpine yet
# https://pkgs.alpinelinux.org/packages?name=librdkafka-dev&branch=edge&repo=&arch=&maintainer=John%20Anthony
RUN apk --no-cache add musl-dev librdkafka-dev ca-certificates git gcc g++ libtool libc-dev musl-dev pkgconf
RUN apk add musl-dev librdkafka-dev ca-certificates git gcc g++ libtool libc-dev pkgconf
RUN apk add build-base coreutils make musl-dev rpm wget curl cyrus-sasl-dev libevent libsasl lz4-dev openssh openssl openssl-dev yajl-dev zlib-dev

ENV LIBRD_VER=2.3.0
# Install librdkafka $LIBRD_VER
# https://gist.github.com/jaihind213/e82d41dc79f52cfa64ca32350bdb27df
# RUN apk --no-cache add ca-certificates git gcc g++ libtool libc-dev musl-dev pkgconf
# RUN apk add \
# build-base \
# coreutils \
# make \
# musl-dev \
# rpm \
# wget \
# curl \
# cyrus-sasl-dev \
# libevent \
# libsasl \
# lz4-dev \
# openssh \
# openssl \
# openssl-dev \
# yajl-dev \
# zlib-dev
# RUN echo " ------> Install librdkafka..."
# RUN apk add --no-cache --virtual .make-deps bash make wget git gcc g++ && apk add --no-cache musl-dev zlib-dev openssl zstd-dev pkgconfig libc-dev && wget /~https://github.com/edenhill/librdkafka/archive/v${LIBRD_VER}.tar.gz && tar -xvf v${LIBRD_VER}.tar.gz && cd librdkafka-${LIBRD_VER} && ./configure --prefix /usr && make && make install && make clean && rm -rf librdkafka-${LIBRD_VER} && rm -rf v${LIBRD_VER}.tar.gz && apk del .make-deps
# RUN export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
# ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
#RUN apk --no-cache add ca-certificates git gcc g++ libtool libc-dev musl-dev pkgconf
#RUN apk add build-base coreutils make musl-dev rpm wget curl cyrus-sasl-dev libevent libsasl lz4-dev openssh openssl openssl-dev yajl-dev zlib-dev

#RUN echo " ------> Install librdkafka..."
#RUN apk add --no-cache --virtual .make-deps bash make wget git gcc g++
#RUN apk add --no-cache musl-dev zlib-dev openssl zstd-dev pkgconfig libc-dev
#RUN wget /~https://github.com/edenhill/librdkafka/archive/v${LIBRD_VER}.tar.gz && tar -xvf v${LIBRD_VER}.tar.gz && cd librdkafka-${LIBRD_VER} && ./configure --prefix /usr && make && make install && make clean && rm -rf librdkafka-${LIBRD_VER} && rm -rf v${LIBRD_VER}.tar.gz && apk del .make-deps

#RUN apk add --no-cache --virtual .make-deps bash make wget git gcc g++ && apk add --no-cache musl-dev zlib-dev openssl zstd-dev pkgconfig libc-dev
#RUN wget /~https://github.com/edenhill/librdkafka/archive/v${LIBRD_VER}.tar.gz
#RUN tar -xvf v${LIBRD_VER}.tar.gz && cd librdkafka-${LIBRD_VER} && ./configure --prefix /usr && make && make install
#RUN export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
#ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/

WORKDIR /app
COPY go.mod .
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ and deploy it to Kubernetes.
```bash
./scripts/install-osxcross-ubuntu.sh
```
- [Build ARM Images on x86 Hosts] Optional
```bash
sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-user-static binfmt-support
update-binfmts --enable qemu-arm
update-binfmts --display qemu-arm
docker buildx build --platform linux/arm64 --file Dockerfile.consumer -t kafka-confluent-go-consumer:latest .
```

- [Confluent Kafka CLI and tools](https://confluent.cloud/environments/env-pr7kdm/clusters/lkc-v1007n/integrations/cli)
```bash
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.49
v0.0.50

0 comments on commit bde23a7

Please sign in to comment.