lgfunderburk commited on
Commit
adb9421
1 Parent(s): a5ce063
Files changed (2) hide show
  1. Dockerfile +20 -7
  2. pyproject.toml +2 -2
Dockerfile CHANGED
@@ -1,32 +1,45 @@
1
  # Use the official Python image as the base image
2
- FROM python:3.10
3
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
  USER user
 
 
6
  ENV HOME=/home/user \
7
  PATH=/home/user/.local/bin:$PATH
 
 
8
  WORKDIR $HOME/app
 
 
9
  COPY --chown=user . $HOME/app
 
 
10
  COPY ./requirements.txt ~/app/requirements.txt
11
 
12
- # Copy the poetry files
13
  COPY pyproject.toml poetry.lock /app/
14
 
15
- # Install poetry
16
  RUN pip install --upgrade pip
17
  RUN pip install poetry
18
- RUN pip install torch==1.11.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
19
 
 
 
20
 
21
- # Set environment variable to create virtualenv within the project directory
22
  ENV POETRY_VIRTUALENVS_IN_PROJECT=true
23
 
24
- # Install project dependencies
25
  RUN poetry lock
26
  RUN poetry install
27
 
28
-
29
  # Copy the rest of the application code
30
  COPY . .
31
 
 
32
  CMD ["poetry", "run", "chainlit", "run", "app.py", "--port", "7860"]
 
1
  # Use the official Python image as the base image
2
+ FROM python:3.9
3
 
4
+ # Set the working directory to /app
5
+ WORKDIR /app
6
+
7
+ # Create a new user and switch to this user
8
  RUN useradd -m -u 1000 user
9
  USER user
10
+
11
+ # Set environment variables for the new user
12
  ENV HOME=/home/user \
13
  PATH=/home/user/.local/bin:$PATH
14
+
15
+ # Set the working directory for the user
16
  WORKDIR $HOME/app
17
+
18
+ # Copy the current directory contents into the container at /app
19
  COPY --chown=user . $HOME/app
20
+
21
+ # Copy requirements file
22
  COPY ./requirements.txt ~/app/requirements.txt
23
 
24
+ # Copy poetry configuration files
25
  COPY pyproject.toml poetry.lock /app/
26
 
27
+ # Upgrade pip and install poetry
28
  RUN pip install --upgrade pip
29
  RUN pip install poetry
 
30
 
31
+ # Install the CPU-only version of torch
32
+ RUN pip install torch==1.11.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
33
 
34
+ # Set environment variable to create a virtual environment within the project directory
35
  ENV POETRY_VIRTUALENVS_IN_PROJECT=true
36
 
37
+ # Lock and install project dependencies using poetry
38
  RUN poetry lock
39
  RUN poetry install
40
 
 
41
  # Copy the rest of the application code
42
  COPY . .
43
 
44
+ # Define the command to run the app
45
  CMD ["poetry", "run", "chainlit", "run", "app.py", "--port", "7860"]
pyproject.toml CHANGED
@@ -7,8 +7,8 @@ license = "Apache 2.0"
7
  readme = "README.md"
8
 
9
  [tool.poetry.dependencies]
10
- python = "^3.10"
11
- farm-haystack = {extras = ["inference"], version = "^1.20.1"}
12
  chainlit = "^0.7.0"
13
  openai = "^0.28.0"
14
  jupyter = "^1.0.0"
 
7
  readme = "README.md"
8
 
9
  [tool.poetry.dependencies]
10
+ python = "^3.9"
11
+ farm-haystack = "^1.20.1"
12
  chainlit = "^0.7.0"
13
  openai = "^0.28.0"
14
  jupyter = "^1.0.0"