tflite-micro/python/tflite_micro/pypi_build.dockerfile
Ryan Kuester e0e052dc7b
feat(py): add scripts for building and uploading to PyPI (#2236)
Add mechanism and scripts for building and uploading the Python distribution
package `tflite_micro` to PyPI. These scripts are intended mainly for use by CI
when generating packages for distribution via for PyPI, and won't be used by
most developers. Building a package for local use is still done via a normal
Bazel build.

Heavily comment the scripts with rationale and technical details of the
implementation.

Make significant updates to python/tflite_micro/README.md which explain
building, installing, and uploading the package to PyPI. Leave some cleanup of
the existing text for later.

Add a build setting `--//python/tflite_micro:compatibility_tag` for setting
:whl's platform compatibility tag. Unfortunately, it cannot derived
automatically from the execution environment by the current implementation of
@rules_python.

BUG=part of #1484
2023-09-20 21:23:56 +00:00

16 lines
913 B
Docker

# Use the Python Packaging Authority's reference build environment
# for binary extensions. Binary extensions are typically built and distributed
# for each target Python version and OS platform. The reference build
# environment contains Python installations for each version, and a C/C++
# toolchain specified for maximum compatibility among x86_64 Linux paltforms.
FROM quay.io/pypa/manylinux_2_28_x86_64
# Install bazel (via bazelisk)
ENV BAZELISK=https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64
ENV BAZEL=/usr/local/bin/bazel
RUN curl --output $BAZEL --location $BAZELISK && chmod 755 $BAZEL
# Append the location of the C/C++ toolchain to the default PATH, where
# bazel expects to find it. The reference environment provides the location
# (typically somewhere under /opt) in DEVTOOLSET_ROOTPATH.
RUN echo "PATH="${PATH}:/${DEVTOOLSET_ROOTPATH}"" >>/etc/environment