Skip to content

Commit 906d10e

Browse files
authored
[fix] Fix issues with Pulsar Alpine docker image stability: remove glibc-compat (apache#23762)
1 parent 3fce309 commit 906d10e

File tree

19 files changed

+469
-243
lines changed

19 files changed

+469
-243
lines changed

docker/glibc-package/Dockerfile

-80
This file was deleted.

docker/glibc-package/scripts/APKBUILD

-53
This file was deleted.

docker/glibc-package/scripts/glibc-bin.trigger

-21
This file was deleted.

docker/glibc-package/scripts/ld.so.conf

-23
This file was deleted.
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
ARG ALPINE_VERSION=3.20
21+
22+
# Builds an Alpine image with kinesis_producer compiled for Alpine Linux / musl
23+
24+
# Build stage
25+
FROM alpine:$ALPINE_VERSION AS kinesis-producer-build
26+
ENV KINESIS_PRODUCER_LIB_VERSION=0.15.12
27+
28+
# Install build dependencies
29+
RUN apk update && apk add --no-cache \
30+
git \
31+
binutils \
32+
coreutils \
33+
alpine-sdk \
34+
util-linux \
35+
cmake \
36+
autoconf \
37+
automake \
38+
libtool \
39+
curl \
40+
bash \
41+
tar \
42+
libuuid \
43+
linux-headers \
44+
zlib \
45+
zlib-dev \
46+
perl \
47+
wget \
48+
boost-dev \
49+
openssl-dev \
50+
curl-dev \
51+
build-base \
52+
util-linux-dev \
53+
g++ \
54+
make \
55+
upx
56+
57+
ENV LANG=C.UTF-8
58+
59+
RUN mkdir /build
60+
COPY kinesis_producer_alpine.patch /build/
61+
62+
# Clone KPL and copy build script
63+
RUN cd /build && \
64+
git clone --depth 1 --single-branch --branch v${KINESIS_PRODUCER_LIB_VERSION} https://github.com/awslabs/amazon-kinesis-producer && \
65+
cd amazon-kinesis-producer && \
66+
git apply ../kinesis_producer_alpine.patch
67+
68+
# Copy and execute build script
69+
COPY build-alpine.sh /build/
70+
RUN chmod +x /build/build-alpine.sh
71+
RUN /build/build-alpine.sh
72+
73+
# Final stage
74+
FROM alpine:$ALPINE_VERSION
75+
COPY --from=kinesis-producer-build /opt/amazon-kinesis-producer /opt/amazon-kinesis-producer
76+
RUN apk update && apk add --no-cache \
77+
brotli-libs \
78+
c-ares \
79+
libcrypto3 \
80+
libcurl \
81+
libgcc \
82+
libidn2 \
83+
libpsl \
84+
libssl3 \
85+
libunistring \
86+
nghttp2-libs \
87+
zlib \
88+
zstd-libs \
89+
libuuid
90+
WORKDIR /opt/amazon-kinesis-producer/bin

docker/glibc-package/README.md docker/kinesis-producer-alpine/README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,19 @@
1919
2020
-->
2121

22-
# GLibc compatibility package
22+
# Alpine image with kinesis_producer compiled for Alpine Linux / musl
2323

24-
This directory includes the Docker scripts to build an image with GLibc compiled for Alpine Linux.
24+
This directory includes the Docker scripts to build an image with `kinesis_producer` for Alpine Linux.
25+
`kinesis_producer` is a native executable that is required by [Amazon Kinesis Producer library (KPL)](https://github.com/awslabs/amazon-kinesis-producer) which is used by the Pulsar IO Kinesis Sink connector. The default `kinesis_producer` binary is compiled for glibc, and it does not work on Alpine Linux which uses musl.
2526

26-
This is used to ensure plugins that are going to be used in the Pulsar image and that are depeding on GLibc, will
27-
still be working correctly in the Alpine Image. (eg: Netty Tc-Native and Kinesis Producer Library).
28-
29-
This image only needs to be re-created when we want to upgrade to a newer version of GLibc.
27+
This image only needs to be re-created when we want to upgrade to a newer version of `kinesis_producer`.
3028

3129
# Steps
3230

3331
1. Change the version in the Dockerfile for this directory.
3432
2. Rebuild the image and push it to Docker Hub:
3533
```
36-
docker buildx build --platform=linux/amd64,linux/arm64 -t apachepulsar/glibc-base:2.38 . --push
34+
docker buildx build --platform=linux/amd64,linux/arm64 -t apachepulsar/pulsar-io-kinesis-sink-kinesis_producer:0.15.12 . --push
3735
```
3836

39-
The image tag is then used in `docker/pulsar/Dockerfile`.
37+
The image tag is then used in `docker/pulsar-all/Dockerfile`. The `kinesis_producer` binary is copied from the image to the `pulsar-all` image that is used by Pulsar Functions to run the Pulsar IO Kinesis Sink connector. The environment variable `PULSAR_IO_KINESIS_KPL_PATH` is set to `/opt/amazon-kinesis-producer/bin/kinesis_producer` and this is how the Kinesis Sink connector knows where to find the `kinesis_producer` binary.

0 commit comments

Comments
 (0)