Spaces:
Sleeping
Sleeping
File size: 1,158 Bytes
de6500f |
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 |
# Use the official Python image as a base image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
GRADIO_SERVER_NAME="0.0.0.0" \
REPO_ID="microsoft/Phi-3-mini-4k-instruct-gguf" \
MODEL_FILE="Phi-3-mini-4k-instruct-q4.gguf"
# Create a working directory
WORKDIR /app
# Install dependencies for building C++ extensions and SSL
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
openssl \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file
COPY requirements.txt /app/
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy SSL certificates
COPY certificates /app/certificates
# Copy the rest of the application code
COPY . /app/
# Create the cache directory with appropriate permissions
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
# Ensure the model is downloaded
RUN python download_model.py
# Expose the port that Gradio will run on
EXPOSE 7860
# Set the user to root
USER root
# Run the application
CMD ["python", "app.py"]
|