chat-gpu / Dockerfile
Nada
besm ellah
b6c5517
# Use Python 3.9 slim image
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create necessary directories and set permissions
RUN mkdir -p /tmp/huggingface && \
chmod -R 777 /tmp/huggingface
# Create a non-root user
RUN useradd -m -s /bin/bash user && \
chown -R user:user /tmp/huggingface
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory
WORKDIR $HOME/app
# Create app directories
RUN mkdir -p $HOME/app/session_data $HOME/app/session_summaries $HOME/app/vector_db $HOME/app/models
# Copy requirements first for better caching
COPY --chown=user:user requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY --chown=user:user . .
# Make start.sh executable
RUN chmod +x start.sh
# Set environment variables
ENV PORT=7860
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV HF_HOME=/tmp/huggingface
ENV TOKENIZERS_PARALLELISM=false
ENV TRANSFORMERS_VERBOSITY=error
ENV BITSANDBYTES_NOWELCOME=1
# Expose the port
EXPOSE 7860
# Run the application using start.sh
CMD ["./start.sh"]