Skip to content

Commit

Permalink
Working Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
xKhronoz committed Jan 25, 2024
1 parent f4b6bdc commit 9fc4bce
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Use the official Python slim image
FROM python:3.11.4-slim-bullseye
# Use the official Python Image
FROM python:3.11.4

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Install the dependencies
RUN apt-get update && apt-get -y install cmake protobuf-compiler libopenblas-dev liblapack-dev liblapacke-dev libeigen3-dev libboost-all-dev

# Switch to the user 'user'
USER user

# Set home to the user's home directory and Poetry's environment variables
Expand All @@ -12,7 +15,8 @@ ENV HOME=/home/user \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
POETRY_CACHE_DIR=/tmp/poetry_cache \
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS"

# Set the working directory to /app
WORKDIR $HOME/app
Expand All @@ -26,18 +30,15 @@ RUN pip install poetry
# Copy the poetry files
COPY --chown=user ./backend/pyproject.toml ./backend/poetry.lock $HOME/app/

# Install the dependencies
RUN poetry install --without dev && \
--no-root && \
rm -rf /tmp/poetry_cache

# Copy the rest of the files
COPY --chown=user ./backend $HOME/app

# Install the package
RUN poetry install --without dev
# Install the dependencies
RUN poetry lock --no-update
RUN poetry install --without dev && \
rm -rf /tmp/poetry_cache

# Change to the package directory
WORKDIR $HOME/app/backend

CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]
CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0"]

0 comments on commit 9fc4bce

Please sign in to comment.