mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
AI: Improve TensorFlow for C build images and scripts (#4922)
* Fixed create_archive.sh The previous version followed symlinks on doing the copy to a temporary folder, so the resulting size was 3 times what it should be. Also *.param files have been excluded from the final tar.gz file. * Migrated tensorflow image to jammy So as to build against an older version of glibc and support more OS versions. * Extend new create_archive.sh to all build types The changes on the main create_archive.sh are now on all the other versions.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM ubuntu:24.10
|
||||
FROM ubuntu:22.04
|
||||
|
||||
LABEL maintainer="PhotoPrism UG <hello@photoprism.app>"
|
||||
|
||||
@@ -21,15 +21,18 @@ RUN apt-get update && apt-get upgrade && \
|
||||
build-essential \
|
||||
python3 \
|
||||
ca-certificates \
|
||||
llvm-17 \
|
||||
clang-17 \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
lsb-release \
|
||||
software-properties-common \
|
||||
gnupg \
|
||||
jq
|
||||
|
||||
# Install bazelisk
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python && \
|
||||
RUN wget https://apt.llvm.org/llvm.sh && chmod u+x llvm.sh && \
|
||||
./llvm.sh 17 && rm llvm.sh && \
|
||||
ln -s /usr/bin/python3 /usr/bin/python && \
|
||||
ln -s /usr/bin/clang-17 /usr/bin/clang && \
|
||||
ln -s /usr/bin/clang++-17 /usr/bin/clang++ && \
|
||||
ln -s /usr/bin/clang-cpp /usr/bin/clang-cpp && \
|
||||
|
||||
@@ -14,13 +14,13 @@ mkdir -p tmp/include/tensorflow/core/platform
|
||||
mkdir -p tmp/include/tsl/platform
|
||||
mkdir -p tmp/include/xla/tsl/c
|
||||
|
||||
cp bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp -av bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp tensorflow/c/eager/*.h tmp/include/tensorflow/c/eager/
|
||||
cp tensorflow/c/*.h LICENSE tmp/include/tensorflow/c/
|
||||
cp tensorflow/core/platform/*.h tmp/include/tensorflow/core/platform
|
||||
cp third_party/xla/third_party/tsl/tsl/platform/*.h tmp/include/tsl/platform
|
||||
cp third_party/xla/xla/tsl/c/*.h tmp/include/xla/tsl/c
|
||||
(cd tmp && tar -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
(cd tmp && tar --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
du -h libtensorflow-$1-$2.tar.gz
|
||||
|
||||
echo "Done"
|
||||
|
||||
@@ -14,13 +14,13 @@ mkdir -p tmp/include/tensorflow/core/platform
|
||||
mkdir -p tmp/include/tsl/platform
|
||||
mkdir -p tmp/include/xla/tsl/c
|
||||
|
||||
cp bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp -av bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp tensorflow/c/eager/*.h tmp/include/tensorflow/c/eager/
|
||||
cp tensorflow/c/*.h LICENSE tmp/include/tensorflow/c/
|
||||
cp tensorflow/core/platform/*.h tmp/include/tensorflow/core/platform
|
||||
cp third_party/xla/third_party/tsl/tsl/platform/*.h tmp/include/tsl/platform
|
||||
cp third_party/xla/xla/tsl/c/*.h tmp/include/xla/tsl/c
|
||||
(cd tmp && tar -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
(cd tmp && tar --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
du -h libtensorflow-$1-$2.tar.gz
|
||||
|
||||
echo "Done"
|
||||
|
||||
@@ -14,13 +14,13 @@ mkdir -p tmp/include/tensorflow/core/platform
|
||||
mkdir -p tmp/include/tsl/platform
|
||||
mkdir -p tmp/include/xla/tsl/c
|
||||
|
||||
cp bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp -av bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp tensorflow/c/eager/*.h tmp/include/tensorflow/c/eager/
|
||||
cp tensorflow/c/*.h LICENSE tmp/include/tensorflow/c/
|
||||
cp tensorflow/core/platform/*.h tmp/include/tensorflow/core/platform
|
||||
cp third_party/xla/third_party/tsl/tsl/platform/*.h tmp/include/tsl/platform
|
||||
cp third_party/xla/xla/tsl/c/*.h tmp/include/xla/tsl/c
|
||||
(cd tmp && tar -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
(cd tmp && tar --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
du -h libtensorflow-$1-$2.tar.gz
|
||||
|
||||
echo "Done"
|
||||
|
||||
@@ -14,13 +14,13 @@ mkdir -p tmp/include/tensorflow/core/platform
|
||||
mkdir -p tmp/include/tsl/platform
|
||||
mkdir -p tmp/include/xla/tsl/c
|
||||
|
||||
cp bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp -av bazel-bin/tensorflow/libtensorflow* tmp/lib/
|
||||
cp tensorflow/c/eager/*.h tmp/include/tensorflow/c/eager/
|
||||
cp tensorflow/c/*.h LICENSE tmp/include/tensorflow/c/
|
||||
cp tensorflow/core/platform/*.h tmp/include/tensorflow/core/platform
|
||||
cp third_party/xla/third_party/tsl/tsl/platform/*.h tmp/include/tsl/platform
|
||||
cp third_party/xla/xla/tsl/c/*.h tmp/include/xla/tsl/c
|
||||
(cd tmp && tar -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
(cd tmp && tar --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
|
||||
du -h libtensorflow-$1-$2.tar.gz
|
||||
|
||||
echo "Done"
|
||||
|
||||
Reference in New Issue
Block a user