Spaces:
Sleeping
Sleeping
File size: 1,535 Bytes
be164df 034506e cbf2f35 0a87b78 034506e f576211 be164df cbf2f35 568b0c8 cbf2f35 034506e 8752244 012abcf be164df cbf2f35 c204ebd be164df 012abcf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | FROM python:3.11-slim
WORKDIR /app
# Install system dependencies (libgomp1 is needed for CTranslate2 multi-threading)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 \
patchelf \
&& rm -rf /var/lib/apt/lists/*
COPY backend/requirements.txt backend/requirements-convert.txt ./
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir -r requirements-convert.txt --extra-index-url https://download.pytorch.org/whl/cpu
# Pinned to v0.3.34, which ships a py3-none-manylinux2014_x86_64 wheel on the
# CPU wheel index — no cp311-specific build required, no compiler, no CMake.
# --only-binary=:all: makes pip HARD-FAIL instead of silently falling back
# to a from-source build if a matching wheel isn't found (fail fast > timeout).
# Confirmed present at: https://abetlen.github.io/llama-cpp-python/whl/cpu/llama-cpp-python/
RUN pip install --no-cache-dir --only-binary=:all: \
llama-cpp-python==0.3.34 \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
RUN SO_FILES=$(find /usr/local/lib/python3.11/site-packages -name '*.so*' -path '*ctranslate2*' 2>/dev/null) \
&& echo "Found CTranslate2 .so files: $SO_FILES" \
&& for f in $SO_FILES; do patchelf --clear-execstack "$f" && echo "Patched: $f"; done
COPY . .
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
RUN mkdir -p /data/models \
&& useradd -m -u 1000 user \
&& chown -R user:user /app /data
ENV OMP_NUM_THREADS=8
USER user
EXPOSE 7860
CMD ["./entrypoint.sh"] |