-
Notifications
You must be signed in to change notification settings - Fork 914
/
Copy pathDockerfile.alpine
89 lines (74 loc) · 2.78 KB
/
Dockerfile.alpine
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
88
#
# 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)
# * kcat (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="v2.10.0"
ENV KCAT_VERSION="master"
ENV CKP_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 kcat && \
mkdir -p /usr/src/kcat && \
cd /usr/src/kcat && \
curl -LfsS https://github.com/edenhill/kcat/archive/${KCAT_VERSION}.tar.gz | \
tar xvzf - --strip-components=1 && \
./configure --prefix=/usr && \
make -j && \
make install && \
cd / && \
rm -rf /usr/src/kcat && \
kcat -V
RUN \
echo Installing confluent-kafka-python && \
mkdir -p /usr/src/confluent-kafka-python && \
cd /usr/src/confluent-kafka-python && \
rm -rf build && \
rm -rf dist && \
python3 -m pip install build && \
python3 -m build && \
python3 -m pip install dist/confluent_kafka*whl && \
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())'