khronoz commited on
Commit
9fc4bce
·
1 Parent(s): f4b6bdc

Working Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,9 +1,12 @@
1
- # Use the official Python slim image
2
- FROM python:3.11.4-slim-bullseye
3
 
4
  # Set up a new user named "user" with user ID 1000
5
  RUN useradd -m -u 1000 user
 
 
6
 
 
7
  USER user
8
 
9
  # Set home to the user's home directory and Poetry's environment variables
@@ -12,7 +15,8 @@ ENV HOME=/home/user \
12
  POETRY_NO_INTERACTION=1 \
13
  POETRY_VIRTUALENVS_IN_PROJECT=1 \
14
  POETRY_VIRTUALENVS_CREATE=1 \
15
- POETRY_CACHE_DIR=/tmp/poetry_cache
 
16
 
17
  # Set the working directory to /app
18
  WORKDIR $HOME/app
@@ -26,18 +30,15 @@ RUN pip install poetry
26
  # Copy the poetry files
27
  COPY --chown=user ./backend/pyproject.toml ./backend/poetry.lock $HOME/app/
28
 
29
- # Install the dependencies
30
- RUN poetry install --without dev && \
31
- --no-root && \
32
- rm -rf /tmp/poetry_cache
33
-
34
  # Copy the rest of the files
35
  COPY --chown=user ./backend $HOME/app
36
 
37
- # Install the package
38
- RUN poetry install --without dev
 
 
39
 
40
  # Change to the package directory
41
  WORKDIR $HOME/app/backend
42
 
43
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]
 
1
+ # Use the official Python Image
2
+ FROM python:3.11.4
3
 
4
  # Set up a new user named "user" with user ID 1000
5
  RUN useradd -m -u 1000 user
6
+ # Install the dependencies
7
+ RUN apt-get update && apt-get -y install cmake protobuf-compiler libopenblas-dev liblapack-dev liblapacke-dev libeigen3-dev libboost-all-dev
8
 
9
+ # Switch to the user 'user'
10
  USER user
11
 
12
  # Set home to the user's home directory and Poetry's environment variables
 
15
  POETRY_NO_INTERACTION=1 \
16
  POETRY_VIRTUALENVS_IN_PROJECT=1 \
17
  POETRY_VIRTUALENVS_CREATE=1 \
18
+ POETRY_CACHE_DIR=/tmp/poetry_cache \
19
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS"
20
 
21
  # Set the working directory to /app
22
  WORKDIR $HOME/app
 
30
  # Copy the poetry files
31
  COPY --chown=user ./backend/pyproject.toml ./backend/poetry.lock $HOME/app/
32
 
 
 
 
 
 
33
  # Copy the rest of the files
34
  COPY --chown=user ./backend $HOME/app
35
 
36
+ # Install the dependencies
37
+ RUN poetry lock --no-update
38
+ RUN poetry install --without dev && \
39
+ rm -rf /tmp/poetry_cache
40
 
41
  # Change to the package directory
42
  WORKDIR $HOME/app/backend
43
 
44
+ CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0"]