Bahodir Nematjonov commited on
Commit
efb3b66
·
1 Parent(s): 8b883c8

docker updated

Browse files
Files changed (2) hide show
  1. Dockerfile +15 -8
  2. static/index.html +1 -1
Dockerfile CHANGED
@@ -1,27 +1,34 @@
1
  # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
- # Set the working directory to /code
5
  WORKDIR /code
6
 
7
- # Copy the current directory contents into the container at /code
8
  COPY ./requirements.txt /code/requirements.txt
9
-
10
- # Install requirements.txt
11
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
13
- # Set up a new user named "user" with user ID 1000
 
 
 
14
  RUN useradd -m -u 1000 user
 
15
  # Switch to the "user" user
16
  USER user
17
- # Set home to the user's home directory
 
18
  ENV HOME=/home/user \
19
- PATH=/home/user/.local/bin:$PATH
20
 
21
  # Set the working directory to the user's home directory
22
  WORKDIR $HOME/app
23
 
24
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
25
  COPY --chown=user . $HOME/app
26
 
 
 
 
 
27
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Set the working directory
5
  WORKDIR /code
6
 
7
+ # Copy requirements.txt and install dependencies
8
  COPY ./requirements.txt /code/requirements.txt
 
 
9
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
10
 
11
+ # Install Ollama (needed for LLM response generation)
12
+ RUN curl -fsSL https://ollama.com/install.sh | sh
13
+
14
+ # Create a new user named "user" with user ID 1000 (non-root user for security)
15
  RUN useradd -m -u 1000 user
16
+
17
  # Switch to the "user" user
18
  USER user
19
+
20
+ # Set environment variables
21
  ENV HOME=/home/user \
22
+ PATH=/home/user/.local/bin:$PATH
23
 
24
  # Set the working directory to the user's home directory
25
  WORKDIR $HOME/app
26
 
27
+ # Copy project files and set ownership to the user
28
  COPY --chown=user . $HOME/app
29
 
30
+ # Expose the port FastAPI will run on
31
+ EXPOSE 7860
32
+
33
+ # Start FastAPI server with Uvicorn
34
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
static/index.html CHANGED
@@ -5,7 +5,7 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>LLM Host API Documentation</title>
7
  <link href="https://cdnjs.cloudflare.com/ajax/libs/prismjs/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
8
- <link href="/home/style.css" rel="stylesheet" />
9
  </head>
10
  <body>
11
  <div class="container">
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>LLM Host API Documentation</title>
7
  <link href="https://cdnjs.cloudflare.com/ajax/libs/prismjs/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
8
+ <link href="style.css" rel="stylesheet" />
9
  </head>
10
  <body>
11
  <div class="container">