shanto268's picture
SQuADDS ML API 2: squadds ec4414d6, registry 1dbf099a
0dc991f verified
Raw History Blame Contribute Delete
974 Bytes
FROM python:3.12-slim
ARG TARGETARCH
# gdstk has no Linux arm64 wheel: compile it there (local arm64 builds only; HF builds amd64 and skips this)
RUN if [ "$TARGETARCH" != "amd64" ]; then apt-get update && apt-get install -y --no-install-recommends build-essential \
cmake zlib1g-dev libqhull-dev && rm -rf /var/lib/apt/lists/*; fi
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH PYTHONUNBUFFERED=1 PYTHONPATH=/home/user/app/src \
KERAS_BACKEND=torch NUMBA_CPU_NAME=generic NUMBA_CACHE_DIR=/home/user/app/numba_cache \
SQUADDS_ML_API_EXIT_ON_LOAD_FAILURE=1 OMP_NUM_THREADS=2 OPENBLAS_NUM_THREADS=2 MKL_NUM_THREADS=2
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
COPY --chown=user . .
RUN python warm.py && date -u +%Y-%m-%dT%H:%M:%SZ > IMAGE_BUILT_AT
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]