WebGPT1.0 / Dockerfile
Samizie's picture
Update Dockerfile
9c98458 verified
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_HOME=/app/.cache
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libxkbcommon0 \
libxcomposite1 \
libxrandr2 \
libasound2 \
libpangocairo-1.0-0 \
libxdamage1 \
libgbm1 \
libpango-1.0-0 \
libgtk-3-0 \
gcc
# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install additional libraries
RUN pip install -U \
transformers \
sentence-transformers \
huggingface_hub \
accelerate \
peft
# Install Playwright and Browsers
RUN pip install playwright && playwright install --with-deps chromium
# Copy app files
COPY . /app
WORKDIR /app
# Create cache directory and set permissions
RUN mkdir -p /app/.cache && \
chmod -R 777 /app/.cache
# Set appropriate permissions for the entire app
RUN chmod -R 755 /app
# Preload SentenceTransformer model
RUN python -c "import os; os.environ['HF_HOME'] = '/workspace/.cache'; from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', cache_folder='/workspace/.cache')"
# Expose port
EXPOSE 7860
# Run the app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]