From 11ffa7e169b267e127c98a42b631334698f45f48 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 16 Nov 2023 15:05:27 +0100 Subject: [PATCH] Add pip docker files --- .gitignore | 1 + docker/pip/amd64.dockerfile | 23 +++++++++++++++++++++++ docker/pip/arm64.dockerfile | 23 +++++++++++++++++++++++ docker/pip/build.sh | 13 +++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 docker/pip/amd64.dockerfile create mode 100644 docker/pip/arm64.dockerfile create mode 100755 docker/pip/build.sh diff --git a/.gitignore b/.gitignore index 2ce17499..4cd5a61b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.iml .idea/ .DS_Store +/docker/pip/out/ diff --git a/docker/pip/amd64.dockerfile b/docker/pip/amd64.dockerfile new file mode 100644 index 00000000..27bbb8b9 --- /dev/null +++ b/docker/pip/amd64.dockerfile @@ -0,0 +1,23 @@ +FROM quay.io/pypa/manylinux_2_28_x86_64 + +RUN yum install -y golang python3 python3-setuptools python3-wheel wget + +WORKDIR /pip + +ARG COMMONVERSION + +RUN wget -O eduvpn-common.tar.xz https://github.com/eduvpn/eduvpn-common/releases/download/$COMMONVERSION/eduvpn-common-$COMMONVERSION.tar.xz +RUN tar xf eduvpn-common.tar.xz + +WORKDIR /pip/eduvpn-common-$COMMONVERSION + +RUN CGO_ENABLED=1 go build -buildvcs=false -o lib/linux/amd64/libeduvpn_common-$COMMONVERSION.so -buildmode=c-shared ./exports + +WORKDIR /pip/eduvpn-common-$COMMONVERSION/wrappers/python + +RUN ./setup.py bdist_wheel --exports-lib-path="../../lib" + +RUN auditwheel repair dist/* + +RUN mkdir /wheelhouse +RUN cp -r wheelhouse/* /wheelhouse \ No newline at end of file diff --git a/docker/pip/arm64.dockerfile b/docker/pip/arm64.dockerfile new file mode 100644 index 00000000..47a832b7 --- /dev/null +++ b/docker/pip/arm64.dockerfile @@ -0,0 +1,23 @@ +FROM quay.io/pypa/manylinux_2_28_aarch64 + +RUN yum install -y golang python3 python3-setuptools python3-wheel wget + +WORKDIR /pip + +ARG COMMONVERSION + +RUN wget -O eduvpn-common.tar.xz https://github.com/eduvpn/eduvpn-common/releases/download/$COMMONVERSION/eduvpn-common-$COMMONVERSION.tar.xz +RUN tar xf eduvpn-common.tar.xz + +WORKDIR /pip/eduvpn-common-$COMMONVERSION + +RUN CGO_ENABLED=1 go build -buildvcs=false -o lib/linux/arm64/libeduvpn_common-$COMMONVERSION.so -buildmode=c-shared ./exports + +WORKDIR /pip/eduvpn-common-$COMMONVERSION/wrappers/python + +RUN ./setup.py bdist_wheel --exports-lib-path="../../lib" + +RUN auditwheel repair dist/* + +RUN mkdir /wheelhouse +RUN cp -r wheelhouse/* /wheelhouse \ No newline at end of file diff --git a/docker/pip/build.sh b/docker/pip/build.sh new file mode 100755 index 00000000..6a9a6f08 --- /dev/null +++ b/docker/pip/build.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +VERSION=$(git tag | sort -V | tail -1) +mkdir -p out/"$VERSION" + +# amd64 +sudo docker build --build-arg COMMONVERSION="$VERSION" -f amd64.dockerfile -t common-pip-amd64 . +sudo docker run -v "$PWD"/out/"$VERSION":/io --rm -ti common-pip-amd64 bash -c "cp /wheelhouse/* /io" + +# arm64 +sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes +sudo docker build --build-arg COMMONVERSION="$VERSION" -f arm64.dockerfile -t common-pip-arm64 . +sudo docker run -v "$PWD"/out/"$VERSION":/io --rm -ti common-pip-arm64 bash -c "cp /wheelhouse/* /io"