From 9d45ab3e4902b00c04e4e8400a7b9a9612777121 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 5 Mar 2023 21:53:22 +0000 Subject: [PATCH] feat: adding docker.compose --- Dockerfile | 17 +++++++---------- dev.Dockerfile | 20 ++++++++++++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 dev.Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index cbef555ba..6a1b7d4eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM logspace/backend_build as backend_build +# FROM logspace/backend_build as backend_build FROM logspace/frontend_build as frontend_build # `python-base` sets up all our shared environment variables @@ -41,29 +41,26 @@ RUN apt-get update \ build-essential libpq-dev git # install poetry - respects $POETRY_VERSION & $POETRY_HOME -RUN curl -sSL https://install.python-poetry.org | python3 - +# RUN curl -sSL https://install.python-poetry.org | python3 - # copy project requirement files here to ensure they will be cached. WORKDIR /app COPY pyproject.toml ./ -#poetry.lock +# copy langflow +COPY ./langflow ./langflow # Copy files from frontend COPY --from=frontend_build /app/build /app/langflow/frontend/build/ -# Copy files from backend and install -COPY --from=backend_build /app/dist/*.whl /app/dist/ -# Copy cli.py -COPY langflow/cli.py /app/langflow/ # RUN pip install langflow-0.0.17-py3-none-any.whl -RUN poetry install +RUN pip install . # RUN poetry add dist/langflow-0.0.17-py3-none-any.whl # RUN rm *.whl # RUN poetry build -# EXPOSE 80 +EXPOSE 5003 -# CMD [ "langchain" ] +CMD [ "langflow" ] diff --git a/dev.Dockerfile b/dev.Dockerfile new file mode 100644 index 000000000..dbe066f37 --- /dev/null +++ b/dev.Dockerfile @@ -0,0 +1,20 @@ +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10 + +WORKDIR /app + +# Install Poetry +RUN apt-get update && apt-get install -y curl +RUN curl -sSL https://install.python-poetry.org | python3 - +# Add Poetry to PATH +ENV PATH="${PATH}:/root/.local/bin" +# Copy the pyproject.toml and poetry.lock files +COPY poetry.lock pyproject.toml ./ +# Copy the rest of the application codes +COPY ./ ./ + + +# install dependencies +RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi + + +CMD ["uvicorn", "langflow.cli:app", "--host", "0.0.0.0", "--port", "5003"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..c01f16c26 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3' + +services: + backend: + build: + context: ./ + dockerfile: ./dev.Dockerfile + ports: + - "5003:5003" + volumes: + - ./:/app + environment: + - PYTHONPATH=/langflow # add this line to set PYTHONPATH + + frontend: + build: ./langflow/frontend + ports: + - "3000:3000" + volumes: + - ./langflow/frontend:/app