1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#
# Copyright 2019 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#############################################################################
# Alpine-based docker container with:
# * Python3
# * librdkafka (fully featured)
# * kafkacat (withouth schema-registry/Avro support)
# * confluent-kafka-python
#
# How to build (from confluent-kafka-python top-level directory):
# $ docker build -f examples/docker/Dockerfile.alpine .
#
#############################################################################
FROM alpine:3.12
COPY . /usr/src/confluent-kafka-python
ENV LIBRDKAFKA_VERSION v1.7.0
ENV KAFKACAT_VERSION master
ENV BUILD_DEPS git make gcc g++ curl pkgconfig bsd-compat-headers zlib-dev openssl-dev cyrus-sasl-dev curl-dev zstd-dev yajl-dev python3-dev
ENV RUN_DEPS bash libcurl cyrus-sasl-gssapiv2 ca-certificates libsasl heimdal-libs krb5 zstd-libs zstd-static yajl python3 py3-pip
RUN \
apk update && \
apk add --no-cache --virtual .dev_pkgs $BUILD_DEPS $BUILD_DEPS_EXTRA && \
apk add --no-cache $RUN_DEPS $RUN_DEPS_EXTRA
RUN \
echo Installing librdkafka && \
mkdir -p /usr/src/librdkafka && \
cd /usr/src/librdkafka && \
curl -LfsS https://github.com/edenhill/librdkafka/archive/${LIBRDKAFKA_VERSION}.tar.gz | \
tar xvzf - --strip-components=1 && \
./configure --prefix=/usr --disable-lz4-ext && \
make -j && \
make install && \
cd / && \
rm -rf /usr/src/librdkafka
RUN \
echo Installing kafkacat && \
mkdir -p /usr/src/kafkacat && \
cd /usr/src/kafkacat && \
curl -LfsS https://github.com/edenhill/kafkacat/archive/${KAFKACAT_VERSION}.tar.gz | \
tar xvzf - --strip-components=1 && \
./configure --prefix=/usr && \
make -j && \
make install && \
cd / && \
rm -rf /usr/src/kafkacat && \
kafkacat -V
RUN \
echo Installing confluent-kafka-python && \
mkdir -p /usr/src/confluent-kafka-python && \
cd /usr/src/confluent-kafka-python && \
rm -rf build && \
python3 setup.py clean -a && \
python3 setup.py build && \
python3 setup.py install && \
cd / && \
rm -rf /usr/src/confluent-kafka-python
RUN \
apk del .dev_pkgs
RUN \
python3 -c 'import confluent_kafka as cf ; print(cf.version(), "librdkafka", cf.libversion())'
|