Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
2 |
+
|
3 |
+
# Install curl and other dependencies
|
4 |
+
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
5 |
+
|
6 |
+
# Install Ollama
|
7 |
+
RUN curl -fsSL https://ollama.ai/install.sh | sh
|
8 |
+
|
9 |
+
# Set up user and working directory
|
10 |
+
RUN useradd -m -u 1000 user
|
11 |
+
USER user
|
12 |
+
ENV HOME=/home/user PATH="/home/user/.local/bin:$PATH"
|
13 |
+
WORKDIR $HOME/app
|
14 |
+
|
15 |
+
# Copy and install Python dependencies
|
16 |
+
COPY --chown=user requirements.txt .
|
17 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
18 |
+
|
19 |
+
# Copy the app code
|
20 |
+
COPY --chown=user . .
|
21 |
+
|
22 |
+
# Expose Streamlit port (8501 is default for HF Spaces Streamlit)
|
23 |
+
EXPOSE 8501
|
24 |
+
|
25 |
+
# Command to run Ollama and Streamlit
|
26 |
+
CMD ["sh", "-c", "ollama serve & sleep 5 && ollama pull llama3.2 && streamlit run app.py --server.port 8501 --server.address 0.0.0.0"]
|