Spaces:
Sleeping
Sleeping
MarcoAland
commited on
Commit
•
515de2c
1
Parent(s):
b745501
Update Dockerfile
Browse files- Dockerfile +21 -13
Dockerfile
CHANGED
@@ -1,22 +1,12 @@
|
|
1 |
-
|
2 |
-
FROM
|
3 |
|
4 |
WORKDIR /code
|
5 |
|
6 |
COPY ./requirements.txt /code/requirements.txt
|
7 |
-
#####
|
8 |
-
# Copy any necessary files
|
9 |
-
COPY . /root/.ollama
|
10 |
|
11 |
-
# Expose the port
|
12 |
-
EXPOSE 11434
|
13 |
-
#######
|
14 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
15 |
|
16 |
-
# Install Ollama
|
17 |
-
# RUN curl -fsSL https://ollama.com/install.sh | sh
|
18 |
-
# RUN ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
|
19 |
-
|
20 |
# Set up a new user named "user" with user ID 1000
|
21 |
RUN useradd -m -u 1000 user
|
22 |
|
@@ -33,8 +23,26 @@ WORKDIR $HOME/app
|
|
33 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
34 |
COPY --chown=user . $HOME/app
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
# RUN ollama serve & sleep 5 && ollama pull MarcoAland/llama3.1-rag-indo
|
37 |
|
38 |
# RUN ollama pull MarcoAland/llama3.1-rag-indo
|
39 |
|
40 |
-
CMD python app.py
|
|
|
1 |
+
# Use multi-stage builds to combine Python and Ollama
|
2 |
+
FROM python:3.9 AS python-base
|
3 |
|
4 |
WORKDIR /code
|
5 |
|
6 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
8 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
9 |
|
|
|
|
|
|
|
|
|
10 |
# Set up a new user named "user" with user ID 1000
|
11 |
RUN useradd -m -u 1000 user
|
12 |
|
|
|
23 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
24 |
COPY --chown=user . $HOME/app
|
25 |
|
26 |
+
# Use Ollama image
|
27 |
+
FROM ollama/ollama AS ollama-base
|
28 |
+
|
29 |
+
# Copy any necessary files
|
30 |
+
COPY . /root/.ollama
|
31 |
+
|
32 |
+
# Expose the port
|
33 |
+
EXPOSE 11434
|
34 |
+
|
35 |
+
# Combine the stages
|
36 |
+
FROM python-base
|
37 |
+
|
38 |
+
COPY --from=ollama-base /root/.ollama /root/.ollama
|
39 |
+
|
40 |
+
# Install Ollama
|
41 |
+
# RUN curl -fsSL https://ollama.com/install.sh | sh
|
42 |
+
# RUN ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
|
43 |
+
|
44 |
# RUN ollama serve & sleep 5 && ollama pull MarcoAland/llama3.1-rag-indo
|
45 |
|
46 |
# RUN ollama pull MarcoAland/llama3.1-rag-indo
|
47 |
|
48 |
+
CMD ["python", "app.py"]
|