Spaces:
Runtime error
Runtime error
File size: 873 Bytes
ae00b8b 3f09d3b 0151794 ae00b8b 0151794 3f09d3b 0151794 3f09d3b 0151794 3f09d3b 0151794 ae00b8b 0151794 ae00b8b 0151794 3f09d3b ae00b8b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# # 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 |