FROM ollama/ollama:0.1.44 | |
# Install Python, pip, and curl (for health check) | |
RUN apt-get update && apt-get install -y python3 python3-pip curl | |
# Copy and install Python dependencies | |
COPY requirements.txt . | |
RUN pip3 install -r requirements.txt | |
# Copy the application code | |
COPY . /app | |
WORKDIR /app | |
# Create and configure startup script | |
RUN echo '#!/bin/bash\nollama serve &\nuntil curl -s http://localhost:11434 > /dev/null; do\n sleep 1\ndone\npython3 app.py' > start.sh && chmod +x start.sh | |
# Expose port for Hugging Face Spaces | |
EXPOSE 7860 | |
# Set the startup script as the entry point | |
CMD ["./start.sh"] |