diff --git a/.github/workflows/build_image_idf_python_wheels.yml b/.github/workflows/build_image_idf_python_wheels.yml new file mode 100644 index 0000000..8b23347 --- /dev/null +++ b/.github/workflows/build_image_idf_python_wheels.yml @@ -0,0 +1,51 @@ +name: Build and push Docker image 'idf-python-wheels' + +on: + push: + branches: + - master + paths: + - 'idf_python_wheels/**' + - '.github/workflows/build_image_idf_python_wheels.yml' + + pull_request: + paths: + - 'idf_python_wheels/**' + - '.github/workflows/build_image_idf_python_wheels.yml' + +env: + IMAGE_DIR: ./idf_python_wheels + IMAGE_NAME: ghcr.io/${{ github.repository }}/idf-python-wheels-armv7l + IMAGE_TAG: v1 + IMAGE_ARCHS: linux/arm + +jobs: + create-docker-image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHRC + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: ${{env.IMAGE_DIR}} + platforms: ${{env.IMAGE_ARCHS}} + tags: ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}} + # Push package to registry only when merged to master + push: ${{ github.event_name != 'pull_request' }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/idf_python_wheels/Dockerfile b/idf_python_wheels/Dockerfile new file mode 100644 index 0000000..4111575 --- /dev/null +++ b/idf_python_wheels/Dockerfile @@ -0,0 +1,95 @@ +# Minimal manylinux-compatible Docker image for ARMv7l (32-bit ARM) +# Based on Debian Bookworm for broad compatibility + +FROM debian:bookworm + +LABEL maintainer="Espressif Systems" +LABEL description="Minimal manylinux-compatible environment for building Python wheels on ARMv7l" + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive \ + LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 + +# Install build dependencies and Python versions +RUN apt-get update && apt-get install -y \ + # Build essentials + build-essential \ + gcc \ + g++ \ + make \ + cmake \ + git \ + wget \ + curl \ + ca-certificates \ + patchelf \ + # Python build dependencies + libssl-dev \ + libffi-dev \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + libncurses5-dev \ + libncursesw5-dev \ + libgdbm-dev \ + liblzma-dev \ + tk-dev \ + zlib1g-dev \ + # Additional libraries commonly needed for wheels + libxml2-dev \ + libxslt1-dev \ + libyaml-dev \ + libglib2.0-dev \ + # PyGObject dependencies + libcairo2-dev \ + pkg-config \ + libgirepository1.0-dev \ + # dbus-python dependencies + libdbus-1-dev \ + libdbus-glib-1-dev \ + # Pillow dependencies + libjpeg-dev \ + libpng-dev \ + libtiff-dev \ + libfreetype6-dev \ + liblcms2-dev \ + libwebp-dev \ + libopenjp2-7-dev \ + libfribidi-dev \ + libharfbuzz-dev \ + libxcb1-dev \ + libxau-dev \ + brotli \ + libbrotli-dev \ + # Python from Debian repos (Bookworm provides 3.11) + python3 \ + python3-dev \ + python3-venv \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +# Install pip and wheel tools +# --break-system-packages is OK because it is docker image and not a system +RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade \ + pip \ + setuptools \ + wheel \ + auditwheel + +# Set up manylinux platform tag +# This makes auditwheel recognize the environment as manylinux-compatible +# Bookworm has glibc 2.36, so we use manylinux_2_35 +RUN echo "manylinux_2_35_armv7l" > /etc/system-release-cpe + +# Create a marker file for manylinux detection +RUN mkdir -p /opt/python && \ + echo "manylinux_2_35_armv7l" > /opt/python/PLATFORM + +# Set working directory +WORKDIR /workspace + +# Default Python +ENV PATH="/usr/bin:${PATH}" + +CMD ["/bin/bash"]