Some checks failed
Auto-update / Auto-update (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Nightly Build / validate-inputs (push) Has been cancelled
Nightly Build / resolve-release-branch (push) Has been cancelled
Nightly Build / create-nightly-tag (push) Has been cancelled
Nightly Build / Run Frontend Tests - Linux (push) Has been cancelled
Nightly Build / Run Frontend Tests - Windows (push) Has been cancelled
Nightly Build / Run Backend Unit Tests (push) Has been cancelled
Nightly Build / Run Nightly Langflow Build (push) Has been cancelled
Nightly Build / Send Slack Notification (push) Has been cancelled
Store pytest durations / Run pytest and store durations (push) Has been cancelled
Update OpenAPI Spec / check-openapi-updates (push) Has been cancelled
* fix: Build and install the langflow-sdk for lfx (fixes nightly) (#12481) * fix: Build and install the langflow-sdk for lfx * Publish sdk as a nightly * Update ci.yml * Update python_test.yml * Update ci.yml * fix: Properly grep for the langflow version (#12486) * fix: Properly grep for the langflow version * Mount the sdk where needed * Skip the sdk * [autofix.ci] apply automated fixes * Update setup.py * fix(docker): Remove broken npm self-upgrade from Docker images (#12309) * fix: replace grep -oP with sed for Node.js version extraction in Docker builds (#12331) The grep -oP (PCRE regex) command fails in the python:3.12.12-slim-trixie Docker base image because PCRE support is not available in the slim variant. This replaces grep -oP with portable sed -nE in all 5 Dockerfiles and adds an empty version guard to fail fast with a clear error message instead of producing a broken download URL. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com> Co-authored-by: vjgit96 <vijay.katuri@ibm.com>
97 lines
3.2 KiB
Docker
97 lines
3.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Keep this syntax directive! It's used to enable Docker BuildKit
|
|
#
|
|
# Backend-only Langflow image
|
|
# - No frontend code or assets
|
|
# - No Playwright
|
|
|
|
################################
|
|
# BUILDER
|
|
################################
|
|
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Required for apify-client
|
|
ENV RUSTFLAGS='--cfg reqwest_unstable'
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get install --no-install-recommends -y \
|
|
build-essential \
|
|
gcc \
|
|
git \
|
|
curl \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy only backend source (excludes frontend)
|
|
COPY ./src/backend ./src/backend
|
|
COPY ./src/lfx ./src/lfx
|
|
|
|
# Create venv and install langflow-base with dependencies
|
|
# Using uv pip instead of uv sync to avoid workspace complexities
|
|
RUN uv venv /app/.venv
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
ENV VIRTUAL_ENV="/app/.venv"
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv pip install ./src/lfx "./src/backend/base[complete,postgresql]"
|
|
|
|
################################
|
|
# RUNTIME
|
|
################################
|
|
FROM python:3.12.12-slim-trixie AS runtime
|
|
|
|
# Install minimal runtime dependencies
|
|
RUN apt-get update \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get install --no-install-recommends -y \
|
|
curl \
|
|
git \
|
|
libpq5 \
|
|
gnupg \
|
|
xz-utils \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=builder /usr/local/bin/uv /usr/local/bin/uv
|
|
COPY --from=builder /usr/local/bin/uvx /usr/local/bin/uvx
|
|
# Install Node.js (required for npx-based MCP stdio servers)
|
|
RUN ARCH=$(dpkg --print-architecture) \
|
|
&& if [ "$ARCH" = "amd64" ]; then NODE_ARCH="x64"; \
|
|
elif [ "$ARCH" = "arm64" ]; then NODE_ARCH="arm64"; \
|
|
else NODE_ARCH="$ARCH"; fi \
|
|
&& NODE_VERSION=$(curl -fsSL https://nodejs.org/dist/latest-v22.x/ \
|
|
| sed -nE "s/.*node-v([0-9]+\.[0-9]+\.[0-9]+)-linux-${NODE_ARCH}\.tar\.xz.*/\1/p" \
|
|
| head -1) \
|
|
&& if [ -z "$NODE_VERSION" ]; then echo "ERROR: Could not determine Node.js version" && exit 1; fi \
|
|
&& curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" \
|
|
| tar -xJ -C /usr/local --strip-components=1
|
|
|
|
# Create non-root user
|
|
RUN useradd --uid 1000 --gid 0 --no-create-home --home-dir /app/data user
|
|
|
|
# Copy only the virtual environment
|
|
COPY --from=builder --chown=1000:0 /app/.venv /app/.venv
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
# Create home directory and ensure proper ownership
|
|
# The user needs write access to /app/data (home) and /app (workdir)
|
|
# Note: .venv is already owned by 1000:0 via COPY --chown above, so no recursive chown needed
|
|
RUN mkdir -p /app/data && chown -R 1000:0 /app/data && chown 1000:0 /app
|
|
|
|
LABEL org.opencontainers.image.title=langflow-backend
|
|
LABEL org.opencontainers.image.authors=['Langflow']
|
|
LABEL org.opencontainers.image.licenses=MIT
|
|
LABEL org.opencontainers.image.url=https://github.com/langflow-ai/langflow
|
|
LABEL org.opencontainers.image.source=https://github.com/langflow-ai/langflow
|
|
|
|
USER user
|
|
WORKDIR /app
|
|
|
|
ENV LANGFLOW_HOST=0.0.0.0
|
|
ENV LANGFLOW_PORT=7860
|
|
|
|
CMD ["python", "-m", "langflow", "run", "--backend-only"]
|