File size: 933 Bytes
a21836d e58a295 a21836d e58a295 |
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 |
FROM nvidia/cuda:11.6.2-base-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /code
# Install Python and dependencies
RUN apt-get update && \
apt-get install -y python3 python3-pip git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create cache directories with proper permissions
RUN mkdir -p /tmp/transformers_cache && \
mkdir -p /tmp/hf_home && \
mkdir -p /tmp/hf_datasets_cache && \
mkdir -p /tmp/diffusers_cache && \
chmod -R 777 /tmp
# Set environment variables for HF
ENV HF_HOME=/tmp/hf_home
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV HF_DATASETS_CACHE=/tmp/hf_datasets_cache
# Copy requirements and install
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy app files
COPY app.py .
# Expose port
EXPOSE 7860
# Run the application with proper host to expose externally
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|