Spaces:
Paused
Paused
File size: 1,101 Bytes
a951334 0dc6b10 a951334 0dc6b10 310eb95 0dc6b10 a951334 310eb95 a951334 310eb95 a951334 0dc6b10 a951334 |
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 46 47 48 49 50 51 52 53 |
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_HOME=/usr/local/cuda
ENV PATH="${CUDA_HOME}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}"
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
git \
wget \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip
RUN pip3 install --upgrade pip
# Create user with UID 1000 (Hugging Face Spaces default)
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy application files
COPY . .
# Set ownership and permissions for user
RUN chown -R user:user /app && \
chmod -R 755 /app
# Expose ports
EXPOSE 7860
EXPOSE 8000
# Set HuggingFace cache directory
ENV HF_HOME=/app/cache
ENV TRANSFORMERS_CACHE=/app/cache
# Switch to non-root user
USER user
# Run the application
CMD ["python3", "app.py"]
|