Skip to content

Commit 90faca3

Browse files
committed
[HSTACK] Added docker builders for binary wheels
1 parent 02306c9 commit 90faca3

File tree

5 files changed

+134
-0
lines changed

5 files changed

+134
-0
lines changed

Dockerfile-build-wheel.arm64

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM quay.io/pypa/manylinux_2_28_aarch64 AS base
4+
5+
WORKDIR /root
6+
7+
RUN <<EOF
8+
dnf install -y epel-release
9+
dnf install -y curl pkg-config openssl ca-certificates openssl-devel patchelf autoconf automake make libtool unzip clang libatomic protobuf-c-compiler openssh-clients
10+
EOF
11+
12+
RUN <<EOF
13+
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
14+
EOF
15+
16+
RUN --mount=type=ssh,mode=0666 \
17+
<<EOF
18+
mkdir -p -m 0700 ~/.ssh
19+
ssh-keyscan git.corp.adobe.com >> ~/.ssh/known_hosts
20+
ssh-keyscan github.com >> ~/.ssh/known_hosts
21+
EOF
22+
23+
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
24+
--mount=type=bind,source=src,target=src,readwrite \
25+
--mount=type=bind,source=python,target=python,readwrite \
26+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
27+
--mount=type=bind,source=build.rs,target=build.rs \
28+
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
29+
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
30+
--mount=type=bind,source=README.md,target=README.md \
31+
--mount=type=bind,source=LICENSE.txt,target=LICENSE.txt \
32+
--mount=type=cache,mode=0777,target=/root/target \
33+
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry/ \
34+
--mount=type=ssh,mode=0666 \
35+
<<EOF
36+
export PATH="/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
37+
python3 -m venv venv
38+
source venv/bin/activate
39+
source /root/.cargo/env
40+
pip3 install maturin==1.8.1
41+
pip3 install -r requirements.txt
42+
maturin build --release --manylinux 2_28 --features protoc,substrait
43+
cp ./target/wheels/*.whl /
44+
EOF

Dockerfile-build-wheel.x86_64

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM quay.io/pypa/manylinux_2_28_x86_64 AS base
4+
5+
WORKDIR /root
6+
7+
RUN <<EOF
8+
dnf install -y epel-release
9+
dnf install -y curl pkg-config openssl ca-certificates openssl-devel patchelf autoconf automake make libtool unzip clang libatomic protobuf-c-compiler openssh-clients
10+
EOF
11+
12+
RUN <<EOF
13+
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
14+
EOF
15+
16+
RUN --mount=type=ssh,mode=0666 \
17+
<<EOF
18+
mkdir -p -m 0700 ~/.ssh
19+
ssh-keyscan git.corp.adobe.com >> ~/.ssh/known_hosts
20+
ssh-keyscan github.com >> ~/.ssh/known_hosts
21+
EOF
22+
23+
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
24+
--mount=type=bind,source=src,target=src,readwrite \
25+
--mount=type=bind,source=python,target=python,readwrite \
26+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
27+
--mount=type=bind,source=build.rs,target=build.rs \
28+
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
29+
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
30+
--mount=type=bind,source=README.md,target=README.md \
31+
--mount=type=bind,source=LICENSE.txt,target=LICENSE.txt \
32+
--mount=type=cache,mode=0777,target=/root/target \
33+
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry/ \
34+
--mount=type=ssh,mode=0666 \
35+
<<EOF
36+
export PATH="/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
37+
python3 -m venv venv
38+
source venv/bin/activate
39+
source /root/.cargo/env
40+
pip3 install maturin==1.8.1
41+
pip3 install -r requirements.txt
42+
maturin build --release --manylinux 2_28 --features protoc,substrait
43+
cp ./target/wheels/*.whl /
44+
EOF

build-linux-arm64.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
mkdir -p ./target-linux/wheels
4+
5+
export DOCKER_BUILDKIT=1
6+
7+
root_dir="$(dirname $0)"
8+
9+
docker build \
10+
--ssh default \
11+
--progress=plain \
12+
--platform linux/arm64 \
13+
-f Dockerfile-build-wheel.arm64 \
14+
-t datafusion-python-builder:latest \
15+
"$root_dir"
16+
17+
id=$(docker create --platform linux/arm64 datafusion-python-builder:latest)
18+
docker cp $id:/datafusion-44.0.0-cp38-abi3-manylinux_2_28_aarch64.whl .
19+
docker rm -v $id

build-linux-x86_64.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
export DOCKER_BUILDKIT=1
4+
5+
root_dir="$(dirname $0)"
6+
7+
docker build \
8+
--ssh default \
9+
--progress=plain \
10+
--platform linux/x86_64 \
11+
-f Dockerfile-build-wheel.x86_64 \
12+
-t datafusion-python-builder:latest \
13+
"$root_dir"
14+
15+
id=$(docker create --platform linux/x86_64 datafusion-python-builder:latest)
16+
docker cp $id:/datafusion-44.0.0-cp38-abi3-manylinux_2_28_x86_64.whl .
17+
docker rm -v $id

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=requirements.txt pyproject.toml
6+
#
7+
pyarrow==19.0.1
8+
# via datafusion (pyproject.toml)
9+
typing-extensions==4.12.2 ; python_full_version < "3.13"
10+
# via datafusion (pyproject.toml)

0 commit comments

Comments
 (0)