Spaces:
Sleeping
Sleeping
File size: 1,021 Bytes
7129113 | 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 41 42 43 44 45 | FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/home/user/.cache/huggingface \
TORCH_HOME=/home/user/.cache/torch \
MPLCONFIGDIR=/tmp/matplotlib \
SAM2_BUILD_CUDA=0
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
curl \
libglib2.0-0 \
libgomp1 \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
COPY --chown=user requirements.txt /home/user/app/requirements.txt
RUN python -m pip install --upgrade pip setuptools wheel
# CPU PyTorch for Hugging Face CPU Spaces.
RUN python -m pip install \
torch==2.5.1 \
torchvision==0.20.1 \
--index-url https://download.pytorch.org/whl/cpu
RUN python -m pip install -r requirements.txt
COPY --chown=user . /home/user/app
EXPOSE 7860
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "7860"] |