fabric-defect-api / Dockerfile
rafatkabir's picture
Update Dockerfile
8dd106c verified
Raw
History Blame Contribute Delete
872 Bytes
FROM python:3.10-slim-bookworm
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
ENV HF_HOME=/tmp/hf_cache \
HF_HUB_CACHE=/tmp/hf_cache/hub \
TORCH_HOME=/tmp/hf_cache/torch \
MPLCONFIGDIR=/tmp/matplotlib \
NUMBA_CACHE_DIR=/tmp/numba \
HOME=/root
RUN mkdir -p /tmp/hf_cache/hub /tmp/hf_cache/torch \
/tmp/matplotlib /tmp/numba \
&& chmod -R 777 /tmp
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& pip uninstall -y opencv-python opencv-python-headless \
&& pip install --no-cache-dir opencv-python-headless==4.9.0.80
COPY . .
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]