Skip to content

Instantly share code, notes, and snippets.

@massa142
Created October 23, 2016 16:27
Show Gist options
  • Save massa142/302f184b635fcb2e0a024ce41d938d02 to your computer and use it in GitHub Desktop.
Save massa142/302f184b635fcb2e0a024ce41d938d02 to your computer and use it in GitHub Desktop.
how to build manylinux wheel

manylinux wheel

参考記事

manylinux1 wheel を作ってみる - methaneのブログ

Dockerfile

# PyPAが提供するmanylinux wheelビルド用Docker
FROM quay.io/pypa/manylinux1_x86_64

# psycopg2とPILのビルド用
RUN yum install -y -q postgresql-devel libjpeg-devel zlib-devel

COPY ./requirements /app/requirements
COPY ./scripts/make-wheels.sh  /app/make-wheels.sh

VOLUME /app/wheelhouse /app/wheelhouse_new
WORKDIR /app/wheelhouse_new

CMD ["bash", "/app/make-wheels.sh"]

Shell Script

# Dockerfile.wheel 用

set -ex

WHEELHOUSE_OLD=/app/wheelhouse
WHEELHOUSE_NEW=/app/wheelhouse_new

# Python-2.7.11 (cp27mu)向けに依存パッケージをwheel化
/opt/python/cp27-cp27mu/bin/pip wheel -r /app/requirements/online.txt -f ${WHEELHOUSE_OLD} -w ${WHEELHOUSE_NEW}

# wheelのmanylinux化
cd ${WHEELHOUSE_NEW}
for f in ./*linux_*; do
  if [ -f $f ]; then
    auditwheel repair $f -w .
    rm $f
  fi
done

Commands

docker build -f Dockerfile.wheel -t pyconjp/wheelhouse:2016 .
docker run -it --rm -v `pwd`/wheelhouse:/app/wheelhouse:ro -v `pwd`/wheelhouse_new:/app/wheelhouse_new pyconjp/wheelhouse:2016
rm -R wheelhouse
mv wheelhouse_new wheelhouse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment