Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -29
Dockerfile
CHANGED
@@ -1,35 +1,20 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
-
# Set
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
# reducing startup time and avoiding dynamic downloads.
|
14 |
-
# The `ollama pull` command can be slow, so pulling it once here is efficient.
|
15 |
-
RUN ollama pull ${OLLAMA_MODEL_NAME}
|
16 |
|
17 |
-
#
|
18 |
-
#
|
19 |
-
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
|
24 |
-
# Expose the port Ollama listens on
|
25 |
-
EXPOSE 11434
|
26 |
-
|
27 |
-
# Command to start the Ollama server.
|
28 |
-
# The base image typically has ENTRYPOINT ["ollama"], so CMD just provides the argument.
|
29 |
-
CMD ["serve"]
|
30 |
-
|
31 |
-
# Optional: Add metadata for Hugging Face Spaces (improves discoverability)
|
32 |
-
LABEL org.opencontainers.image.title="Ollama with a tiny model"
|
33 |
-
LABEL org.opencontainers.image.description="Runs Ollama with a pre-loaded model less than 500MB"
|
34 |
-
LABEL org.opencontainers.image.licenses="MIT"
|
35 |
-
LABEL org.opencontainers.image.authors="Your Name/Org"
|
|
|
1 |
+
# Use a Python base image
|
2 |
+
FROM python:3.9-slim-buster
|
3 |
|
4 |
+
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install dependencies
|
8 |
+
COPY requirements.txt .
|
9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
|
11 |
+
# Copy your application code
|
12 |
+
COPY app.py .
|
|
|
|
|
|
|
13 |
|
14 |
+
# Expose the port your API will run on (Hugging Face Spaces uses 7860 by default for Gradio/Streamlit,
|
15 |
+
# but for custom Docker, you can choose, e.g., 8000 for FastAPI or 5000 for Flask).
|
16 |
+
EXPOSE 8000
|
17 |
|
18 |
+
# Command to run your FastAPI/Flask app
|
19 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] # For FastAPI
|
20 |
+
# CMD ["python", "app.py"] # For a simple Flask app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|