AI: Use Docker build argument to specify TensorFlow version #222 #4922

This also ensures that the archives will be created in /build.

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2025-04-06 09:05:06 +02:00
parent a97d66d6e4
commit d9c260b865
8 changed files with 31 additions and 19 deletions

View file

@ -5,7 +5,9 @@ LABEL maintainer="PhotoPrism UG <hello@photoprism.app>"
ENV DEBIAN_FRONTEND=noninteractive
ENV TMP=/tmp
ENV TF_VERSION=2.18.0
# see https://docs.docker.com/build/building/variables/#env-usage-example
ARG TF_VERSION=2.18.0
ENV TF_VERSION=$TF_VERSION
# apt default settings
RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \

View file

@ -5,7 +5,9 @@ LABEL maintainer="PhotoPrism UG <hello@photoprism.app>"
ENV DEBIAN_FRONTEND=noninteractive
ENV TMP=/tmp
ENV TF_VERSION=2.18.0
# see https://docs.docker.com/build/building/variables/#env-usage-example
ARG TF_VERSION=2.18.0
ENV TF_VERSION=$TF_VERSION
# apt default settings
RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \

View file

@ -20,7 +20,7 @@ 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 --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
(cd tmp && tar --exclude=*.params -czf /build/libtensorflow-$1-$2.tar.gz .)
du -h libtensorflow-$1-$2.tar.gz
echo "Done"
echo "Done."

View file

@ -20,7 +20,7 @@ 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 --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
(cd tmp && tar --exclude=*.params -czf /build/libtensorflow-$1-$2.tar.gz .)
du -h libtensorflow-$1-$2.tar.gz
echo "Done"
echo "Done."

View file

@ -1,8 +1,9 @@
ARG BUILDER_SHA2=06040763c500bd2ebaaa4585d4729c88d2c8ccec94baa7fbe9bbe3dc2827d79d
FROM gcr.io/tensorflow-testing/ml-devinfra-linux-aarch64-cross-compile:infrastructure-public-image-${BUILDER_SHA2}
ARG TF_VERSION
ENV TF_VERSION=${TF_VERSION}
# see https://docs.docker.com/build/building/variables/#env-usage-example
ARG TF_VERSION=2.18.0
ENV TF_VERSION=$TF_VERSION
COPY ./create_archive.sh .
COPY ./Makefile Makefile

View file

@ -20,7 +20,7 @@ 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 --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
(cd tmp && tar --exclude=*.params -czf /build/libtensorflow-$1-$2.tar.gz .)
du -h libtensorflow-$1-$2.tar.gz
echo "Done"
echo "Done."

View file

@ -20,7 +20,7 @@ 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 --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
(cd tmp && tar --exclude=*.params -czf /build/libtensorflow-$1-$2.tar.gz .)
du -h libtensorflow-$1-$2.tar.gz
echo "Done"
echo "Done."