diffusionLLM / Dockerfile
triflix's picture
Create Dockerfile
d4b2aea verified
raw
history blame contribute delete
896 Bytes
FROM python:3.11-slim-bookworm
# System deps
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
# Non-root user (HF Spaces requirement)
RUN useradd -m -u 1000 user
# Install PyTorch CPU-only
RUN pip install --no-cache-dir \
torch --index-url https://download.pytorch.org/whl/cpu
# Install Python deps
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
rm /tmp/requirements.txt
# Copy app
COPY app.py /app/app.py
# Ownership
RUN chown -R user:user /app
# Switch to non-root
USER user
# Env
ENV HOME=/home/user
ENV HF_HOME=/home/user/.cache/huggingface
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface
ENV OMP_NUM_THREADS=2
ENV MKL_NUM_THREADS=2
ENV TOKENIZERS_PARALLELISM=false
ENV QUANTIZE=true
ENV PORT=7860
WORKDIR /app
EXPOSE 7860
CMD ["python", "app.py"]