forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to build Alpine APK packages and Python wheels (apache#7101)
- Loading branch information
Showing
11 changed files
with
443 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
|
||
FROM alpine:3.11 | ||
|
||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache \ | ||
cmake make build-base curl \ | ||
python3-dev \ | ||
libffi-dev \ | ||
perl linux-headers bash \ | ||
alpine-sdk | ||
|
||
#################################### | ||
# These dependencies can be found in Ubuntu but they're not compiled with -fPIC, | ||
# so they cannot be statically linked into a shared library | ||
#################################### | ||
|
||
# Download and compile boost | ||
RUN curl -O -L https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz && \ | ||
tar xfz boost_1_72_0.tar.gz && \ | ||
cd /boost_1_72_0 && \ | ||
./bootstrap.sh --with-libraries=program_options,regex,system,python --with-python=/usr/bin/python3 && \ | ||
./b2 cxxflags=-fPIC link=static threading=multi variant=release install && \ | ||
rm -rf /boost_1_72_0.tar.gz /boost_1_72_0 | ||
|
||
# ZLib | ||
RUN curl -O -L https://zlib.net/zlib-1.2.11.tar.gz && \ | ||
tar xfz zlib-1.2.11.tar.gz && \ | ||
cd zlib-1.2.11 && \ | ||
CFLAGS="-fPIC -O3" ./configure && \ | ||
make -j4 && make install && \ | ||
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11 | ||
|
||
# Compile OpenSSL | ||
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0j.tar.gz && \ | ||
tar xfz OpenSSL_1_1_0j.tar.gz && \ | ||
cd openssl-OpenSSL_1_1_0j/ && \ | ||
./Configure -fPIC no-shared linux-x86_64 && \ | ||
make -j8 && make install && \ | ||
rm -rf /OpenSSL_1_1_0j.tar.gz /openssl-OpenSSL_1_1_0j | ||
|
||
# Download and copile protoubf | ||
RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.11.3/protobuf-cpp-3.11.3.tar.gz && \ | ||
tar xvfz protobuf-cpp-3.11.3.tar.gz && \ | ||
cd protobuf-3.11.3/ && \ | ||
CXXFLAGS=-fPIC ./configure && \ | ||
make -j8 && make install && \ | ||
rm -rf /protobuf-cpp-3.11.3.tar.gz /protobuf-3.11.3 | ||
|
||
# LibCurl | ||
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_61_0/curl-7.61.0.tar.gz && \ | ||
tar xvfz curl-7.61.0.tar.gz && \ | ||
cd curl-7.61.0 && \ | ||
CFLAGS=-fPIC ./configure && \ | ||
make -j8 && make install && \ | ||
rm -rf /curl-7.61.0.tar.gz /curl-7.61.0 | ||
|
||
# Zstandard | ||
RUN curl -O -L https://github.com/facebook/zstd/releases/download/v1.3.7/zstd-1.3.7.tar.gz && \ | ||
tar xvfz zstd-1.3.7.tar.gz && \ | ||
cd zstd-1.3.7 && \ | ||
CFLAGS="-fPIC -O3" make -j8 && \ | ||
make install && \ | ||
rm -rf /zstd-1.3.7 /zstd-1.3.7.tar.gz | ||
|
||
# Snappy | ||
RUN curl -L https://github.com/google/snappy/archive/1.1.8.tar.gz --output snappy-1.1.8.tar.gz && \ | ||
tar xvfz snappy-1.1.8.tar.gz && \ | ||
cd snappy-1.1.8 && \ | ||
CXXFLAGS="-fPIC -O3" cmake . && \ | ||
make -j8 && make install && \ | ||
rm -rf /snappy-1.1.8 /snappy-1.1.8.tar.gz | ||
|
||
|
||
RUN pip3 install wheel twine | ||
|
||
RUN adduser pulsar -D && \ | ||
addgroup pulsar abuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
|
||
FROM alpine:3.8 | ||
|
||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache \ | ||
cmake make build-base curl \ | ||
python3-dev \ | ||
libffi-dev \ | ||
perl linux-headers bash \ | ||
alpine-sdk | ||
|
||
#################################### | ||
# These dependencies can be found in Ubuntu but they're not compiled with -fPIC, | ||
# so they cannot be statically linked into a shared library | ||
#################################### | ||
|
||
# Download and compile boost | ||
RUN curl -O -L https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz && \ | ||
tar xfz boost_1_72_0.tar.gz && \ | ||
cd /boost_1_72_0 && \ | ||
./bootstrap.sh --with-libraries=program_options,regex,system,python --with-python=/usr/bin/python3 && \ | ||
./b2 cxxflags=" -fPIC -I/usr/include/python3.6m" link=static threading=multi variant=release install && \ | ||
rm -rf /boost_1_72_0.tar.gz /boost_1_72_0 | ||
|
||
# ZLib | ||
RUN curl -O -L https://zlib.net/zlib-1.2.11.tar.gz && \ | ||
tar xfz zlib-1.2.11.tar.gz && \ | ||
cd zlib-1.2.11 && \ | ||
CFLAGS="-fPIC -O3" ./configure && \ | ||
make -j4 && make install && \ | ||
rm -rf /zlib-1.2.11.tar.gz /zlib-1.2.11 | ||
|
||
# Compile OpenSSL | ||
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_0j.tar.gz && \ | ||
tar xfz OpenSSL_1_1_0j.tar.gz && \ | ||
cd openssl-OpenSSL_1_1_0j/ && \ | ||
./Configure -fPIC no-shared linux-x86_64 && \ | ||
make -j8 && make install && \ | ||
rm -rf /OpenSSL_1_1_0j.tar.gz /openssl-OpenSSL_1_1_0j | ||
|
||
# Download and copile protoubf | ||
RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.11.3/protobuf-cpp-3.11.3.tar.gz && \ | ||
tar xvfz protobuf-cpp-3.11.3.tar.gz && \ | ||
cd protobuf-3.11.3/ && \ | ||
CXXFLAGS=-fPIC ./configure && \ | ||
make -j8 && make install && \ | ||
rm -rf /protobuf-cpp-3.11.3.tar.gz /protobuf-3.11.3 | ||
|
||
# LibCurl | ||
RUN curl -O -L https://github.com/curl/curl/releases/download/curl-7_61_0/curl-7.61.0.tar.gz && \ | ||
tar xvfz curl-7.61.0.tar.gz && \ | ||
cd curl-7.61.0 && \ | ||
CFLAGS=-fPIC ./configure && \ | ||
make -j8 && make install && \ | ||
rm -rf /curl-7.61.0.tar.gz /curl-7.61.0 | ||
|
||
# Zstandard | ||
RUN curl -O -L https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz && \ | ||
tar xvfz zstd-1.4.4.tar.gz && \ | ||
cd zstd-1.4.4 && \ | ||
CFLAGS="-fPIC -O3" make -j8 && \ | ||
make install && \ | ||
rm -rf /zstd-1.4.4 /zstd-1.4.4.tar.gz | ||
|
||
# Snappy | ||
RUN curl -L https://github.com/google/snappy/archive/1.1.8.tar.gz --output snappy-1.1.8.tar.gz && \ | ||
tar xvfz snappy-1.1.8.tar.gz && \ | ||
cd snappy-1.1.8 && \ | ||
CXXFLAGS="-fPIC -O3" cmake . && \ | ||
make -j8 && make install && \ | ||
rm -rf /snappy-1.1.8 /snappy-1.1.8.tar.gz | ||
|
||
|
||
RUN pip3 install wheel twine | ||
|
||
RUN adduser pulsar -D && \ | ||
addgroup pulsar abuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
# Build Alpine Image with pulsar python3 and cpp client libraries | ||
|
||
set -e | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
IMAGE_NAME=${IMAGE_NAME:-apachepulsar/pulsar-build:alpine-3.11} | ||
|
||
echo "==== Building image $IMAGE_NAME" | ||
|
||
cd $ROOT_DIR/pulsar-client-cpp/docker/alpine | ||
docker build -t $IMAGE_NAME -f $ROOT_DIR/pulsar-client-cpp/docker/alpine/Dockerfile . | ||
|
||
echo "==== Successfully built image $IMAGE_NAME" |
38 changes: 38 additions & 0 deletions
38
pulsar-client-cpp/docker/alpine/build-wheel-file-within-docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
set -e -x | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd $ROOT_DIR/pulsar-client-cpp | ||
PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR:-/usr/include/python3.8} | ||
PYTHON_LIBRARY=${PYTHON_LIBRARY:-/usr/lib/python3.8} | ||
|
||
cmake . -DBUILD_TESTS=OFF \ | ||
-DBUILD_PYTHON_WRAPPER=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DLINK_STATIC=ON \ | ||
-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} \ | ||
-DPYTHON_LIBRARY=${PYTHON_LIBRARY} | ||
|
||
make -j2 _pulsar | ||
|
||
cd python | ||
python3 setup.py bdist_wheel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
set -e | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
PROJECT_VERSION=$(python $ROOT_DIR/src/get-project-version.py) | ||
IMAGE_NAME=${IMAGE_NAME:-apachepulsar/pulsar-build:alpine-3.11} | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd $ROOT_DIR | ||
|
||
echo "Using image: $IMAGE_NAME" | ||
VOLUME_OPTION=${VOLUME_OPTION:-"-v $ROOT_DIR:/pulsar"} | ||
COMMAND="/pulsar/pulsar-client-cpp/docker/alpine/build-wheel-file-within-docker.sh" | ||
DOCKER_CMD="docker run -i ${VOLUME_OPTION} ${IMAGE_NAME}" | ||
$DOCKER_CMD bash -c "${COMMAND}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pkg | ||
perf | ||
examples | ||
lib |
Oops, something went wrong.