From 03430c7944f2579496240e1384a45d7935bc2ce2 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Wed, 15 Mar 2023 14:40:07 -0300 Subject: [PATCH] fix: docker-compose now creates a working dev environment #21 --- dev.Dockerfile | 17 +++++++---------- docker-compose.yml | 8 ++++++-- langflow/frontend/dev.Dockerfile | 6 ++++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 langflow/frontend/dev.Dockerfile diff --git a/dev.Dockerfile b/dev.Dockerfile index 508a4bafd..cd5c52306 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -1,21 +1,18 @@ -FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10 +FROM python:3.10-slim WORKDIR /app # Install Poetry -# RUN apt-get update && apt-get install -y curl -# RUN curl -sSL https://install.python-poetry.org | python3 - +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" +ENV PATH="${PATH}:/root/.local/bin" # # Copy the pyproject.toml and poetry.lock files -# COPY poetry.lock pyproject.toml ./ +COPY poetry.lock pyproject.toml ./ # Copy the rest of the application codes COPY ./ ./ # Install dependencies -RUN pip install -e . +RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi - -WORKDIR /app/langflow/backend - -CMD ["uvicorn", "langflow_backend.main:app", "--host", "127.0.0.1", "--port", "5003", "--reload"] \ No newline at end of file +CMD ["uvicorn", "langflow_backend.main:app", "--host", "0.0.0.0", "--port", "5003", "--reload"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 62905c475..45c43e56e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,13 +9,17 @@ services: - "5003:5003" volumes: - ./:/app + platform: linux/amd64 + command: bash -c "uvicorn langflow_backend.main:app --host 0.0.0.0 --port 5003 --reload" frontend: - build: ./langflow/frontend + build: + context: ./langflow/frontend + dockerfile: ./dev.Dockerfile ports: - "3000:3000" volumes: - ./langflow/frontend:/app # Set process.env.BACKEND to the backend service environment: - - BACKEND=http://backend:5003 + - BACKEND="http://backend:5003" diff --git a/langflow/frontend/dev.Dockerfile b/langflow/frontend/dev.Dockerfile new file mode 100644 index 000000000..fc519be74 --- /dev/null +++ b/langflow/frontend/dev.Dockerfile @@ -0,0 +1,6 @@ +FROM node:14-alpine as frontend_build +ARG BACKEND +WORKDIR /app +COPY . /app +RUN npm install +CMD ["npm", "start"] \ No newline at end of file