2019-04-03 21:45:24 +00:00
|
|
|
FROM balenalib/raspberrypi3-python:latest-stretch-build
|
|
|
|
|
|
2019-06-20 16:55:42 +00:00
|
|
|
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
|
|
|
|
|
ARG ONNXRUNTIME_SERVER_BRANCH=master
|
|
|
|
|
|
2019-04-03 21:45:24 +00:00
|
|
|
#Enforces cross-compilation through Quemu
|
|
|
|
|
RUN [ "cross-build-start" ]
|
|
|
|
|
|
|
|
|
|
RUN install_packages \
|
|
|
|
|
sudo \
|
|
|
|
|
build-essential \
|
|
|
|
|
curl \
|
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
|
libssl-dev \
|
|
|
|
|
wget \
|
|
|
|
|
python3 \
|
|
|
|
|
python3-pip \
|
|
|
|
|
python3-dev \
|
|
|
|
|
git \
|
2019-06-24 00:59:38 +00:00
|
|
|
tar \
|
|
|
|
|
libatlas-base-dev
|
2019-04-03 21:45:24 +00:00
|
|
|
|
|
|
|
|
RUN pip3 install --upgrade pip
|
|
|
|
|
RUN pip3 install --upgrade setuptools
|
|
|
|
|
RUN pip3 install --upgrade wheel
|
2018-12-04 03:13:59 +00:00
|
|
|
RUN pip3 install numpy
|
|
|
|
|
|
|
|
|
|
# Build the latest cmake
|
|
|
|
|
WORKDIR /code
|
2019-05-14 20:33:44 +00:00
|
|
|
RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz
|
|
|
|
|
RUN tar zxf cmake-3.14.3.tar.gz
|
2018-12-04 03:13:59 +00:00
|
|
|
|
2019-05-14 20:33:44 +00:00
|
|
|
WORKDIR /code/cmake-3.14.3
|
2018-12-04 03:13:59 +00:00
|
|
|
RUN ./configure --system-curl
|
|
|
|
|
RUN make
|
|
|
|
|
RUN sudo make install
|
|
|
|
|
|
2019-04-03 21:45:24 +00:00
|
|
|
# Set up build args
|
|
|
|
|
ARG BUILDTYPE=MinSizeRel
|
|
|
|
|
ARG BUILDARGS="--config ${BUILDTYPE} --arm"
|
|
|
|
|
|
2018-12-04 03:13:59 +00:00
|
|
|
# Prepare onnxruntime Repo
|
2019-04-03 21:45:24 +00:00
|
|
|
WORKDIR /code
|
2019-06-20 16:55:42 +00:00
|
|
|
RUN git clone --single-branch --branch ${ONNXRUNTIME_SERVER_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime
|
2018-12-04 03:13:59 +00:00
|
|
|
|
|
|
|
|
# Start the basic build
|
2019-04-03 21:45:24 +00:00
|
|
|
WORKDIR /code/onnxruntime
|
2020-05-25 00:36:57 +00:00
|
|
|
RUN ./build.sh --use_openmp ${BUILDARGS} --update --build
|
2018-12-04 03:13:59 +00:00
|
|
|
|
|
|
|
|
# Build Shared Library
|
2020-05-25 00:36:57 +00:00
|
|
|
RUN ./build.sh --use_openmp ${BUILDARGS} --build_shared_lib
|
2018-12-04 03:13:59 +00:00
|
|
|
|
2019-04-03 21:45:24 +00:00
|
|
|
# Build Python Bindings and Wheel
|
2020-05-25 00:36:57 +00:00
|
|
|
RUN ./build.sh --use_openmp ${BUILDARGS} --enable_pybind --build_wheel
|
2018-12-04 03:13:59 +00:00
|
|
|
|
|
|
|
|
# Build Output
|
2019-04-03 21:45:24 +00:00
|
|
|
RUN ls -l /code/onnxruntime/build/Linux/${BUILDTYPE}/*.so
|
|
|
|
|
RUN ls -l /code/onnxruntime/build/Linux/${BUILDTYPE}/dist/*.whl
|
|
|
|
|
|
2019-05-14 20:33:44 +00:00
|
|
|
RUN [ "cross-build-end" ]
|