Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working Dockerfile #7

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 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,29 +15,30 @@ 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

# Update pip and wheel
RUN pip install --upgrade pip setuptools wheel

# Install poetry
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"]
3 changes: 3 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ torch = [
# ]
docx2txt = "^0.8"

# Dev Dependencies here
[tool.poetry.group.dev.dependencies]


[build-system]
requires = ["poetry-core"]
Expand Down
Loading