Spaces:
Build error
Build error
Upload 2 files
Browse files- Dockerfile +19 -3
Dockerfile
CHANGED
@@ -1,16 +1,32 @@
|
|
1 |
-
#
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
-
|
4 |
FROM python:3.9
|
5 |
|
|
|
|
|
|
|
|
|
6 |
RUN useradd -m -u 1000 user
|
|
|
|
|
7 |
USER user
|
|
|
|
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
|
|
10 |
WORKDIR /app
|
11 |
|
|
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
|
|
15 |
COPY --chown=user . /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Use the official Python image from the Docker Hub
|
|
|
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Install curl
|
5 |
+
RUN apt-get update && apt-get install -y curl
|
6 |
+
|
7 |
+
# Create a new user with a home directory and set the user ID
|
8 |
RUN useradd -m -u 1000 user
|
9 |
+
|
10 |
+
# Switch to the new user
|
11 |
USER user
|
12 |
+
|
13 |
+
# Set the PATH environment variable to include the user's local bin directory
|
14 |
ENV PATH="/home/user/.local/bin:$PATH"
|
15 |
|
16 |
+
# Set the working directory to /app
|
17 |
WORKDIR /app
|
18 |
|
19 |
+
# Copy the requirements.txt file and install the dependencies
|
20 |
COPY --chown=user ./requirements.txt requirements.txt
|
21 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
22 |
|
23 |
+
# Copy the rest of the application code to the /app directory
|
24 |
COPY --chown=user . /app
|
25 |
+
|
26 |
+
# Install Ollama
|
27 |
+
RUN curl -fsSL https://ollama.com/install.sh | sh
|
28 |
+
|
29 |
+
RUN ollama pull mistral
|
30 |
+
RUN ollama pull nomic-embed-text
|
31 |
+
# Set the command to run the application
|
32 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|