mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
* Inital work for raspberrypi arm64 docker container #109 * Add aarch64 docker container to build tensorflow * Add tensorflow for aarch64 * Add docker compose for raspberrypi running on 64bit kernel
This commit is contained in:
committed by
Michael Mayer
parent
ab369eb75e
commit
6e5be73f9c
65
docker/tensorflow/Dockerfile.aarch64
Normal file
65
docker/tensorflow/Dockerfile.aarch64
Normal file
@@ -0,0 +1,65 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
LABEL maintainer="Michael Mayer <michael@liquidbytes.net>"
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV TMP /tmp
|
||||
ENV EXTRA_BAZEL_ARGS "--host_javabase=@local_jdk//:jdk"
|
||||
|
||||
# Configure apt-get
|
||||
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry
|
||||
RUN echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends
|
||||
RUN echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests
|
||||
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes
|
||||
RUN echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissin
|
||||
|
||||
# Install dev / build dependencies
|
||||
RUN apt-get update && apt-get upgrade && \
|
||||
apt-get install \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
g++-4.8 \
|
||||
gcc-4.8 \
|
||||
libc6-dev \
|
||||
zlib1g-dev \
|
||||
libssl-dev \
|
||||
curl \
|
||||
chrpath \
|
||||
pkg-config \
|
||||
unzip \
|
||||
zip \
|
||||
make \
|
||||
nano \
|
||||
wget \
|
||||
git \
|
||||
libtool \
|
||||
python3 \
|
||||
python3-git \
|
||||
openjdk-8-jdk
|
||||
|
||||
# Use GCC 4.8 and Python 3 as default
|
||||
# See https://www.tensorflow.org/install/source#tested_build_configurations
|
||||
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 && \
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10 && \
|
||||
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 10
|
||||
|
||||
# Download Bazel & TensorFlow
|
||||
WORKDIR "/home/tensorflow"
|
||||
RUN wget https://github.com/tensorflow/tensorflow/archive/v1.14.0.tar.gz
|
||||
RUN tar -xzf v1.14.0.tar.gz
|
||||
|
||||
# Install Bazel
|
||||
# RUN wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-linux-x86_64
|
||||
RUN wget https://github.com/guysoft/bazel-bin/raw/master/bazel-0.24.1-aarch64
|
||||
RUN mv bazel-0.24.1-aarch64 /usr/local/bin/bazel && chmod 755 /usr/local/bin/bazel
|
||||
|
||||
# Configure TensorFlow
|
||||
WORKDIR "/home/tensorflow/tensorflow-1.14.0"
|
||||
COPY ./*.sh ./
|
||||
COPY ./*.diff ./
|
||||
COPY ./tf_configure.bazelrc .tf_configure.bazelrc
|
||||
COPY ./Makefile.aarch64 Makefile
|
||||
RUN make patch
|
||||
21
docker/tensorflow/Makefile.aarch64
Normal file
21
docker/tensorflow/Makefile.aarch64
Normal file
@@ -0,0 +1,21 @@
|
||||
TF_VERSION=1.14.0
|
||||
|
||||
all: libtensorflow static archive
|
||||
patch:
|
||||
git apply tensorflow-$(TF_VERSION).diff
|
||||
libtensorflow:
|
||||
bazel build --jobs 2 --config=opt //tensorflow:libtensorflow.so
|
||||
static:
|
||||
env JOB_COUNT=2 ARCH=armv8-a ./build_static.sh
|
||||
archive:
|
||||
rm -rf tmp
|
||||
mkdir -p tmp/lib/
|
||||
mkdir -p tmp/include/tensorflow/c/eager/
|
||||
cp bazel-bin/tensorflow/libtensorflow.so.$(TF_VERSION) tmp/lib/libtensorflow.so
|
||||
cp bazel-bin/tensorflow/libtensorflow_framework.so.$(TF_VERSION) tmp/lib/libtensorflow_framework.so
|
||||
cp tensorflow/c/eager/c_api.h tmp/include/tensorflow/c/eager/
|
||||
cp tensorflow/c/c_api.h tensorflow/c/c_api_experimental.h LICENSE tmp/include/tensorflow/c/
|
||||
#(cd tmp && tar -czf ../libtensorflow-nvidia-jetson-nano-$(TF_VERSION).tar.gz .)
|
||||
#du -h libtensorflow-nvidia-jetson-nano-$(TF_VERSION).tar.gz
|
||||
guy@golem4:/tmp/photoprism/docker/tensorflow$
|
||||
|
||||
3
docker/tensorflow/build_dynamic.sh
Executable file
3
docker/tensorflow/build_dynamic.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
time bazel build --jobs 2 --config=opt //tensorflow:libtensorflow.so
|
||||
|
||||
14
docker/tensorflow/docker-compose-aarch64.yml
Normal file
14
docker/tensorflow/docker-compose-aarch64.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
version: '3.6'
|
||||
|
||||
services:
|
||||
build:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.aarch64
|
||||
container_name: tensorflow-build
|
||||
tty: true
|
||||
restart: always
|
||||
volumes:
|
||||
- ./out:/output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user