ollama-gguf-cpu / Dockerfile
SkyNetWalker's picture
Update Dockerfile
5506c9f verified
# Use a base Ubuntu image
FROM ubuntu:22.04
# Set environment variables to prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies: curl for Ollama, python3 and pip for the app
RUN apt update && apt install -y curl python3 python3-pip
# Create a non-root user to solve the Gradio permission error
RUN useradd -m -u 1000 user
# Install Ollama using its official installation script (as root)
RUN curl -fsSL https://ollama.com/install.sh | sh
# Set the working directory
WORKDIR /app
# Copy only the necessary application files with correct ownership
COPY --chown=user app.py .
COPY --chown=user requirements.txt .
COPY --chown=user run.sh .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Make the startup script executable
RUN chmod +x run.sh
# Switch to the non-root user
USER user
# Set home environment for the user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Expose the Gradio port
EXPOSE 7860
# Set the entrypoint to our startup script
CMD ["./run.sh"]