Spaces:
Runtime error
Runtime error
# # Use the latest Ollama base image | |
from ollama/ollama:latest | |
# Update package manager and install necessary packages | |
Run apt-get update && apt-get install -y \ | |
curl \ | |
python3-pip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Flask | |
Run pip3 install flask | |
# Create a non-root user 'user' with UID 1000 | |
Run useradd -m -u 1000 user | |
# Set environment variables | |
env HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH \ | |
OLLAMA_HOST=0.0.0.0 | |
# Set the working directory | |
WORKDIR $HOME/app | |
# Copy the Python script for the web server | |
Copy app.py . | |
# Change ownership of the working directory to the non-root user | |
Run chown -R user:user $HOME/app | |
# Switch to the non-root user | |
User User | |
# Expose port 11434 for Ollama and 5000 for the web server | |
EXPOSE 11434 5000 | |
# Start Ollama server and the Flask web server | |
cmd ollama serve & python3 app.py |