Spaces:
Paused
Paused
| FROM ollama/ollama:latest | |
| # Create user and directories | |
| RUN useradd -ms /bin/bash ollama-user | |
| ENV HOME=/home/ollama-user | |
| WORKDIR $HOME | |
| RUN mkdir -p $HOME/.ollama && chown -R ollama-user:ollama-user $HOME/.ollama | |
| # Install required tools | |
| RUN apt-get update && apt-get install -y netcat python3 python3-pip | |
| # Copy server proxy script and entrypoint | |
| COPY entrypoint.sh /usr/local/bin/entrypoint.sh | |
| COPY serverprox.py $HOME/serverprox.py | |
| # Set permissions | |
| RUN chmod +x /usr/local/bin/entrypoint.sh && pip install ollama requests flask | |
| # Switch user | |
| USER ollama-user | |
| # Set environment for Ollama backend | |
| ENV OLLAMA_HOST=0.0.0.0:11434 | |
| ENV OLLAMA_NUM_PARALLEL=1 | |
| # Expose ports | |
| EXPOSE 7860 | |
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | |