0504ankitsharma commited on
Commit
1e04944
·
verified ·
1 Parent(s): 31ed4a7

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -20
Dockerfile CHANGED
@@ -1,32 +1,44 @@
1
  # Use the official Python image from the Docker Hub
2
  FROM python:3.9
3
 
4
- # Install curl and Ollama as root
5
- RUN apt-get update && apt-get install -y curl \
6
- && curl -fsSL https://ollama.com/install.sh | sh \
7
- && rm -rf /var/lib/apt/lists/*
8
 
9
- # Pull the necessary models using Ollama
10
- RUN ollama pull mistral && ollama pull nomic-embed-text
11
 
12
- # Create a new user with a home directory and set the user ID
13
- RUN useradd -m -u 1000 user
14
 
15
- # Switch to the new user
16
- USER user
17
 
18
- # Set the PATH environment variable to include the user's local bin directory
19
- ENV PATH="/home/user/.local/bin:$PATH"
20
 
21
- # Set the working directory to /app
22
- WORKDIR /app
 
23
 
24
- # Copy the requirements.txt file and install the dependencies
25
- COPY --chown=user ./requirements.txt requirements.txt
26
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
27
 
28
- # Copy the rest of the application code to the /app directory
29
- COPY --chown=user . /app
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  # Set the command to run the application
32
- 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
+ # Create the directory and give appropriate permissions
30
+ RUN mkdir -p /.app && chmod 777 /.app
31
+
32
+ WORKDIR /.app
33
+
34
+ # Copy the entry point script
35
+ COPY entrypoint.sh /entry.sh
36
+ RUN chmod +x /entry.sh
37
+
38
+ ENTRYPOINT ["/entrypoint.sh"]
39
+ CMD ["ollama", "serve"]
40
 
41
  # Set the command to run the application
42
+ # CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
43
+
44
+ EXPOSE 7860