Spaces:
Running
Running
dingusagar
commited on
Create Dockerfile
Browse files- Dockerfile +55 -0
Dockerfile
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use a lightweight Linux base image
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
|
5 |
+
# Set non-interactive mode for apt-get
|
6 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
7 |
+
|
8 |
+
# Install Python, pip, curl, and other dependencies
|
9 |
+
RUN apt-get update && apt-get install -y \
|
10 |
+
python3 \
|
11 |
+
python3-pip \
|
12 |
+
curl \
|
13 |
+
&& apt-get clean \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
+
|
16 |
+
# Install Ollama using curl
|
17 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
18 |
+
|
19 |
+
# Add a non-root user (optional for security)
|
20 |
+
RUN useradd -m -u 1000 user
|
21 |
+
USER user
|
22 |
+
|
23 |
+
# Set environment variables for Ollama
|
24 |
+
ENV HOME=/home/user \
|
25 |
+
PATH=/home/user/.local/bin:$PATH \
|
26 |
+
OLLAMA_HOST=0.0.0.0
|
27 |
+
|
28 |
+
# Set working directory
|
29 |
+
WORKDIR $HOME/app
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
# Install Python dependencies for your application
|
34 |
+
RUN pip3 install ollama
|
35 |
+
|
36 |
+
# Pull the required Ollama model
|
37 |
+
#RUN ollama serve & sleep 5 && ollama pull llama3.2:1b
|
38 |
+
|
39 |
+
RUN pip install gradio
|
40 |
+
# Copy your Python application
|
41 |
+
COPY app.py $HOME/app/app.py
|
42 |
+
|
43 |
+
# Expose the Ollama server port
|
44 |
+
EXPOSE 11434
|
45 |
+
EXPOSE 7860
|
46 |
+
|
47 |
+
# Set the entrypoint to bash (optional)
|
48 |
+
#ENTRYPOINT ["/bin/bash"]
|
49 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
50 |
+
|
51 |
+
RUN echo "Build Complete"
|
52 |
+
|
53 |
+
# Command to run your Python application
|
54 |
+
#CMD ["sh", "-c", "ollama run llama3.2:1b > ollama.log 2>&1 & python3 app.py"]
|
55 |
+
CMD ["python3", "app.py"]
|