excom-ai-demo / Dockerfile
plarnholt's picture
Update Dockerfile
0db58b4 verified
raw
history blame
904 Bytes
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HUB_ENABLE_HF_TRANSFER=1 \
# Give numba/outlines a writable cache in Spaces runtime
NUMBA_CACHE_DIR=/tmp/numba_cache \
OUTLINES_CACHE_DIR=/tmp/outlines_cache
# If issues persist, add: NUMBA_DISABLE_FILE_SYSTEM_CACHING=1
RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt /app/
RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
# ensure caches exist & are writable in Spaces container
RUN mkdir -p /tmp/numba_cache /tmp/outlines_cache && chmod -R 777 /tmp/numba_cache /tmp/outlines_cache
COPY app.py /app/
# Spaces exposes the app on $PORT
ENV PORT=7860
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]