forked from langflow-ai/langflow
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker image with endpoint entry (#22)
* build backend with endpoint entry * add curl to the entrypoint based image * poetry version from pyproject.xml
- Loading branch information
Showing
4 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FROM python:3.11-slim-bookworm as builder | ||
RUN pip install poetry==1.7.1 | ||
|
||
ENV POETRY_VIRTUALENVS_IN_PROJECT=1 | ||
ENV POETRY_VIRTUALENVS_CREATE=1 | ||
ENV POETRY_CACHE_DIR=/tmp/poetry_cache | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN echo 'Acquire::http::Timeout "30";\nAcquire::http::ConnectionAttemptDelayMsec "2000";\nAcquire::https::Timeout "30";\nAcquire::https::ConnectionAttemptDelayMsec "2000";\nAcquire::ftp::Timeout "30";\nAcquire::ftp::ConnectionAttemptDelayMsec "2000";\nAcquire::Retries "15";' > /etc/apt/apt.conf.d/99timeout_and_retries \ | ||
&& apt-get update && apt-get -y dist-upgrade && apt-get -y install gcc | ||
RUN mkdir /app | ||
COPY pyproject.toml poetry.lock* README* /app/ | ||
|
||
COPY src/backend /app/src/backend | ||
|
||
RUN cd /app && poetry install --no-interaction --no-ansi -E deploy | ||
|
||
FROM python:3.11-slim-bookworm as runtime | ||
|
||
ARG VERSION | ||
RUN echo "The version is: $VERSION" | ||
|
||
LABEL org.opencontainers.image.title=ragstack-ai-langflow | ||
LABEL org.opencontainers.image.version=$VERSION | ||
LABEL org.opencontainers.image.authors=['DataStax'] | ||
LABEL org.opencontainers.image.licenses=BUSL-1.1 | ||
LABEL org.opencontainers.image.url=https://github.com/datastax/ragstack-ai-langflow | ||
LABEL org.opencontainers.image.source=https://github.com/datastax/ragstack-ai-langflow | ||
|
||
# Update package list and install curl | ||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV PATH="/app/.venv/bin:$PATH" | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN useradd ragstack -u 10000 -g 0 --no-create-home --home-dir /app/data | ||
RUN mkdir /data | ||
RUN chown -R 10000:0 /data | ||
|
||
USER 10000 | ||
|
||
WORKDIR /app | ||
COPY --from=builder --chown=10000 /app/ /app/ | ||
|
||
ENTRYPOINT ["langflow", "run", "--host", "0.0.0.0", "--backend-only"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
#!/bin/bash | ||
set -e | ||
RAGSTACK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )" | ||
|
||
cd $RAGSTACK_DIR | ||
if command -v poetry &> /dev/null | ||
then | ||
version=$(poetry version | awk '{print $2}') | ||
else | ||
pyproject="$RAGSTACK_DIR/../pyproject.toml" | ||
echo "pyproject file $pyproject" | ||
if [[ -f "$pyproject" ]]; then | ||
version=$(grep "^version" $pyproject | awk -F'=' '{gsub(/ /,"",$2); print $2}' | tr -d '"') | ||
if [[ -n "$version" ]]; then | ||
echo "Poetry is not installed. Version from pyproject.toml: $version" | ||
else | ||
echo "Version not found in $pyproject." | ||
exit 1 | ||
fi | ||
else | ||
echo "pyproject.toml file $pyproject not found." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "build docker image version $version ..." | ||
|
||
cd $RAGSTACK_DIR/docker/backend | ||
echo "Building backend image" | ||
docker build -t ragstack-ai-langflow-backend:latest -f Dockerfile ../../.. | ||
echo "Done ragstack-ai-langflow-backend:latest " | ||
docker build --build-arg VERSION=${version} -t ragstack-ai-langflow-backend:latest -f Dockerfile ../../.. | ||
echo "Done ragstack-ai-langflow-backend:latest " | ||
|
||
cd $RAGSTACK_DIR/docker/backend-ep | ||
docker build --build-arg VERSION=${version} -t ragstack-ai-langflow-backend-ep:latest -f Dockerfile ../../.. | ||
echo "Done ragstack-ai-langflow-backend-ep:latest " | ||
|