Spaces:
Sleeping
Sleeping
FROM python:3.11 | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Ollama | |
RUN curl -fsSL https://ollama.com/install.sh | sh | |
# Set working directory | |
WORKDIR /code | |
# Set Ollama environment variables | |
ENV OLLAMA_HOST=0.0.0.0:11434 | |
ENV OLLAMA_HOME=/code/.ollama | |
# Copy requirements and install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application files | |
COPY . . | |
# Create Ollama directories with proper permissions | |
RUN mkdir -p /code/.ollama && chmod 755 /code/.ollama | |
# Expose ports | |
EXPOSE 7860 | |
EXPOSE 11434 | |
# Create startup script | |
RUN echo '#!/bin/bash\n\ | |
export OLLAMA_HOME=/code/.ollama\n\ | |
export OLLAMA_HOST=0.0.0.0:11434\n\ | |
ollama serve &\n\ | |
sleep 15\n\ | |
ollama pull llm_hub/child_trauma_gemma\n\ | |
python app.py' > /code/start.sh && chmod +x /code/start.sh | |
CMD ["/code/start.sh"] |