From 7d8fefa562cf0ded31bd05f45dde61ffa360339a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 27 Jun 2024 04:24:35 -0700 Subject: [PATCH] Update dockerfiles and docker-build.yml (#2389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update docker-build.yml to disable pre-release by default * chore: Update Dockerfiles to set LANGFLOW_HOST and LANGFLOW_PORT The Dockerfiles have been updated to set the environment variables LANGFLOW_HOST and LANGFLOW_PORT. This ensures that the correct host and port are used when running the langflow application. * 🔧 (build_and_push_backend.Dockerfile): remove unnecessary host and port configuration to simplify the Dockerfile and focus on backend-only functionality * chore: Update LANGFLOW_CONFIG_DIR in docker-compose.yml The LANGFLOW_CONFIG_DIR environment variable in docker-compose.yml has been updated to /app/langflow. This change ensures that the correct directory is used for storing logs, file storage, monitor data, and secret keys. --- .github/workflows/docker-build.yml | 6 +++--- docker/build_and_push.Dockerfile | 6 ++++-- docker/build_and_push_backend.Dockerfile | 2 +- docker/build_and_push_base.Dockerfile | 3 ++- docker_example/docker-compose.yml | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index cfffc24d2..e327ce1aa 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -11,7 +11,7 @@ on: pre_release: required: false type: boolean - default: true + default: false workflow_dispatch: inputs: @@ -86,10 +86,10 @@ jobs: include: - component: backend dockerfile: ./docker/build_and_push_backend.Dockerfile - tags: langflowai/langflow-backend:${{ inputs.version }},langflowai/langflow-backend:1.0-alpha + tags: ${{ inputs.pre_release == 'true' && format('langflowai/langflow-backend:{0}', inputs.version) || format('langflowai/langflow-backend:{0},langflowai/langflow-backend:latest', inputs.version) }} - component: frontend dockerfile: ./docker/frontend/build_and_push_frontend.Dockerfile - tags: langflowai/langflow-frontend:${{ inputs.version }},langflowai/langflow-frontend:1.0-alpha + tags: ${{ inputs.pre_release == 'true' && format('langflowai/langflow-frontend:{0}', inputs.version) || format('langflowai/langflow-frontend:{0},langflowai/langflow-frontend:latest', inputs.version) }} steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx diff --git a/docker/build_and_push.Dockerfile b/docker/build_and_push.Dockerfile index 79f6ac8d7..448a802e6 100644 --- a/docker/build_and_push.Dockerfile +++ b/docker/build_and_push.Dockerfile @@ -93,5 +93,7 @@ ENV PATH="/app/.venv/bin:${PATH}" USER user WORKDIR /app -ENTRYPOINT ["python", "-m", "langflow", "run"] -CMD ["--host", "0.0.0.0", "--port", "7860"] \ No newline at end of file +ENV LANGFLOW_HOST=0.0.0.0 +ENV LANGFLOW_PORT=7860 + +ENTRYPOINT ["python", "-m", "langflow", "run"] \ No newline at end of file diff --git a/docker/build_and_push_backend.Dockerfile b/docker/build_and_push_backend.Dockerfile index 8b82da524..2efbefb10 100644 --- a/docker/build_and_push_backend.Dockerfile +++ b/docker/build_and_push_backend.Dockerfile @@ -5,4 +5,4 @@ ARG LANGFLOW_IMAGE FROM $LANGFLOW_IMAGE RUN rm -rf /app/.venv/langflow/frontend -CMD ["--host", "0.0.0.0", "--port", "7860", "--backend-only"] +CMD ["--backend-only"] diff --git a/docker/build_and_push_base.Dockerfile b/docker/build_and_push_base.Dockerfile index 916531df2..d539c1ae8 100644 --- a/docker/build_and_push_base.Dockerfile +++ b/docker/build_and_push_base.Dockerfile @@ -95,6 +95,7 @@ USER user # Install the package from the .tar.gz RUN python -m pip install /app/src/backend/base/dist/*.tar.gz --user +ENV LANGFLOW_HOST=0.0.0.0 +ENV LANGFLOW_PORT=7860 ENTRYPOINT ["python", "-m", "langflow", "run"] -CMD ["--host", "0.0.0.0", "--port", "7860"] diff --git a/docker_example/docker-compose.yml b/docker_example/docker-compose.yml index a8fddac71..61c02e65e 100644 --- a/docker_example/docker-compose.yml +++ b/docker_example/docker-compose.yml @@ -10,9 +10,9 @@ services: environment: - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow # This variable defines where the logs, file storage, monitor data and secret keys are stored. - - LANGFLOW_CONFIG_DIR=/var/lib/langflow + - LANGFLOW_CONFIG_DIR=/app/langflow volumes: - - langflow-data:/var/lib/langflow + - langflow-data:/app/langflow postgres: image: postgres:16