Update Dockerfiles to include user creation and use --user flag for pip install

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-12 15:09:43 -03:00
commit 5d75d930bd
2 changed files with 8 additions and 6 deletions

View file

@ -74,10 +74,11 @@ RUN $POETRY_HOME/bin/poetry build
FROM python-base as final
# Copy virtual environment and built .tar.gz from builder base
RUN useradd -m -u 1000 user
COPY --from=builder-base /app/dist/*.tar.gz ./
# Install the package from the .tar.gz
RUN pip install *.tar.gz
RUN python -m pip install *.tar.gz --user
WORKDIR /app
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
ENTRYPOINT ["python", "-m", "langflow", "run"]
CMD ["--host", "0.0.0.0", "--port", "7860"]

View file

@ -82,10 +82,11 @@ RUN cd src/backend/base && $POETRY_HOME/bin/poetry build --format sdist
FROM python-base as final
# Copy virtual environment and built .tar.gz from builder base
RUN useradd -m -u 1000 user
COPY --from=builder-base /app/src/backend/base/dist/*.tar.gz ./
# Install the package from the .tar.gz
RUN pip install *.tar.gz
RUN pip install *.tar.gz --user
WORKDIR /app
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
ENTRYPOINT ["python", "-m", "langflow", "run"]
CMD ["--host", "0.0.0.0", "--port", "7860"]