Spaces:
Sleeping
Sleeping
# Use Ubuntu as the base image | |
FROM ubuntu:latest | |
# Update package list and install required system dependencies | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
gnupg \ | |
python3 \ | |
python3-venv \ | |
python3-pip | |
# Set up a virtual environment for Python | |
RUN python3 -m venv /venv | |
ENV PATH="/venv/bin:$PATH" | |
# Install required Python packages inside the virtual environment | |
RUN pip install --no-cache-dir streamlit requests tornado==6.0.4 | |
# Install NVIDIA container toolkit | |
RUN curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ | |
&& echo "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/ $(. /etc/os-release; echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/nvidia-container-toolkit.list | |
RUN apt-get update && apt-get install -y nvidia-container-toolkit || true | |
# Install Ollama | |
RUN curl https://ollama.ai/install.sh | sh | |
# Create the directory and set appropriate permissions | |
RUN mkdir -p /.ollama && chmod 777 /.ollama | |
WORKDIR /.ollama | |
# Copy the entry point script | |
COPY entrypoint.sh /entrypoint.sh | |
RUN chmod +x /entrypoint.sh | |
# Copy the application script | |
COPY app.py /app.py | |
# Expose both ports | |
EXPOSE 7860 8501 | |
# Set the entry point script as the default command | |
ENTRYPOINT ["/entrypoint.sh"] | |