Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Add target architecture to Dockerfile. Supports building multiarch images. Closes #324

davidmezzetti3ecdded75fc1
diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile
index 6fbaf3f5..7bec6303 100644
--- a/docker/base/Dockerfile
+++ b/docker/base/Dockerfile
@@ -5,6 +5,9 @@ FROM $BASE_IMAGE
# Install GPU-enabled version of PyTorch if set
ARG GPU
+# Target CPU architecture
+ARG TARGETARCH
+
# Set Python version (i.e. 3, 3.7, 3.8)
ARG PYTHON_VERSION=3
@@ -24,7 +27,7 @@ RUN \
# Install txtai project and dependencies
ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
python -m pip install --no-cache-dir -U pip wheel setuptools && \
- if [ -z ${GPU} ]; then pip install --no-cache-dir pip install torch==1.12.1+cpu torchvision==0.13.1+cpu -f https://download.pytorch.org/whl/torch_stable.html; fi && \
+ if [ -z ${GPU} ] && { [ -z ${TARGETARCH} ] || [ ${TARGETARCH} = "amd64" ] ;}; then pip install --no-cache-dir pip install torch==1.12.1+cpu torchvision==0.13.1+cpu -f https://download.pytorch.org/whl/torch_stable.html; fi && \
python -m pip install --no-cache-dir txtai${COMPONENTS} && \
python -c "import sys, importlib.util as util; 1 if util.find_spec('nltk') else sys.exit(); import nltk; nltk.download('punkt')" && \
\