Update tflite-runtime docker build.

PiperOrigin-RevId: 275584132
Change-Id: I61917e94de42e582758c2f46c2f222388c547a7a
This commit is contained in:
Dmitry Kovalev 2019-10-18 18:35:21 -07:00 committed by TensorFlower Gardener
parent 5a3db9b77a
commit 6a4473eb06
6 changed files with 50 additions and 76 deletions

View File

@ -0,0 +1,36 @@
ARG IMAGE
FROM ${IMAGE}
COPY update_sources.sh /
RUN /update_sources.sh
RUN dpkg --add-architecture armhf
RUN dpkg --add-architecture arm64
RUN apt-get update && \
apt-get install -y \
debhelper \
dh-python \
python-all \
python-setuptools \
python-wheel \
python-numpy \
libpython-dev \
libpython-dev:armhf \
libpython-dev:arm64 \
python3-all \
python3-setuptools \
python3-wheel \
python3-numpy \
libpython3-dev \
libpython3-dev:armhf \
libpython3-dev:arm64 \
crossbuild-essential-armhf \
crossbuild-essential-arm64 \
zlib1g-dev \
zlib1g-dev:armhf \
zlib1g-dev:arm64 \
swig \
curl \
unzip \
git && \
apt-get clean

View File

@ -1,31 +0,0 @@
ARG VERSION
FROM debian:${VERSION}
RUN dpkg --add-architecture armhf
RUN dpkg --add-architecture arm64
RUN apt-get update && apt-get install -y \
debhelper \
dh-python \
python-all \
python-setuptools \
python-wheel \
python-numpy \
libpython-dev \
libpython-dev:armhf \
libpython-dev:arm64 \
python3-all \
python3-setuptools \
python3-wheel \
python3-numpy \
libpython3-dev \
libpython3-dev:armhf \
libpython3-dev:arm64 \
crossbuild-essential-armhf \
crossbuild-essential-arm64 \
zlib1g-dev \
zlib1g-dev:armhf \
zlib1g-dev:arm64 \
swig \
curl \
unzip \
git

View File

@ -1,34 +0,0 @@
ARG VERSION
FROM ubuntu:${VERSION}
COPY update_sources.sh /
RUN /update_sources.sh
RUN dpkg --add-architecture armhf
RUN dpkg --add-architecture arm64
RUN apt-get update && apt-get install -y \
debhelper \
dh-python \
python-all \
python-setuptools \
python-wheel \
python-numpy \
libpython-dev \
libpython-dev:armhf \
libpython-dev:arm64 \
python3-all \
python3-setuptools \
python3-wheel \
python3-numpy \
libpython3-dev \
libpython3-dev:armhf \
libpython3-dev:arm64 \
crossbuild-essential-armhf \
crossbuild-essential-arm64 \
zlib1g-dev \
zlib1g-dev:armhf \
zlib1g-dev:arm64 \
swig \
curl \
unzip \
git

View File

@ -9,9 +9,7 @@ BUILD_DEB ?= n
MAKEFILE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) MAKEFILE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
TENSORFLOW_DIR := $(MAKEFILE_DIR)/../../../.. TENSORFLOW_DIR := $(MAKEFILE_DIR)/../../../..
NAME := $(word 1, $(subst :, ,$(BASE_IMAGE))) TAG_IMAGE := "tflite-runtime-builder-$(subst :,-,$(BASE_IMAGE))"
VERSION := $(word 2, $(subst :, ,$(BASE_IMAGE)))
TAG_IMAGE := "tflite-builder-$(BASE_IMAGE)"
.PHONY: help \ .PHONY: help \
docker-image \ docker-image \
@ -26,10 +24,10 @@ help:
@echo "make clean -- remove built wheel files" @echo "make clean -- remove built wheel files"
docker-image: docker-image:
docker build -t $(TAG_IMAGE) --build-arg VERSION=$(VERSION) -f Dockerfile.$(NAME) . docker build -t $(TAG_IMAGE) --build-arg IMAGE=$(BASE_IMAGE) .
docker-shell: docker-image docker-shell: docker-image
docker run --rm -it -v $(TENSORFLOW_DIR):/tensorflow $(TAG_IMAGE) docker run --rm -it -v $(TENSORFLOW_DIR):/tensorflow --workdir /tensorflow $(TAG_IMAGE)
docker-build: docker-image docker-build: docker-image
docker run \ docker run \
@ -40,7 +38,7 @@ docker-build: docker-image
-v $(CURDIR):/out \ -v $(CURDIR):/out \
--rm -it $(TAG_IMAGE) \ --rm -it $(TAG_IMAGE) \
/bin/bash -c "tensorflow/tensorflow/lite/tools/pip_package/build_pip_package.sh && \ /bin/bash -c "tensorflow/tensorflow/lite/tools/pip_package/build_pip_package.sh && \
cp /tmp/tflite_pip/*.deb /tmp/tflite_pip/$(PYTHON)/dist/*.whl /out" (cp /tmp/tflite_pip/*.deb /tmp/tflite_pip/$(PYTHON)/dist/*.whl /out 2>/dev/null || true)"
clean: clean:
rm -f *.whl rm -f *.whl *.deb

View File

@ -68,5 +68,5 @@ if [[ "${TENSORFLOW_TARGET}" == "rpi" ]]; then
elif [[ "${TENSORFLOW_TARGET}" == "aarch64" ]]; then elif [[ "${TENSORFLOW_TARGET}" == "aarch64" ]]; then
dpkg-buildpackage -b -rfakeroot -us -uc -tc -d -a arm64 dpkg-buildpackage -b -rfakeroot -us -uc -tc -d -a arm64
else else
dpkg-buildpackage -b -rfakeroot -us -uc -tc dpkg-buildpackage -b -rfakeroot -us -uc -tc -d
fi fi

View File

@ -14,10 +14,15 @@
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
#!/bin/bash
. /etc/os-release . /etc/os-release
[[ "${NAME}" == "Ubuntu" ]] || exit 0
sed -i "s/deb\ /deb \[arch=amd64\]\ /g" /etc/apt/sources.list sed -i "s/deb\ /deb \[arch=amd64\]\ /g" /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME} main universe" >> /etc/apt/sources.list cat <<EOT >> /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-updates main universe" >> /etc/apt/sources.list deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME} main universe
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-security main universe" >> /etc/apt/sources.list deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-updates main universe
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-security main universe
EOT