-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathDockerfile.langflow.dev
More file actions
62 lines (51 loc) · 2.01 KB
/
Dockerfile.langflow.dev
File metadata and controls
62 lines (51 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Development Dockerfile for building Langflow from source
# Allows building from any Git branch/repo for testing
FROM python:3.12-slim AS builder
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV RUSTFLAGS="--cfg reqwest_unstable"
# Accept build arguments for git repository and branch
ARG GIT_REPO=https://github.com/langflow-ai/langflow.git
ARG GIT_BRANCH=main
# Install system dependencies
# (+) Install uv for faster Python package management (needs root, goes to /usr/local/bin)
# (+) Create non-root group: "langflow"
# (+) Create non-root user: "langflow"
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
ca-certificates \
gnupg \
npm \
rustc cargo pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pip install uv \
&& groupadd --gid 103000 langflow \
&& useradd --uid 103000 --gid langflow --no-create-home langflow
# Switch to non-root user: "langflow"
USER langflow
# Create working directory: /app (owned by "langflow")
WORKDIR /app
# Clone the repository and checkout the specified branch
RUN echo "Cloning ${GIT_REPO} branch ${GIT_BRANCH}..." && \
git clone --depth 1 --branch ${GIT_BRANCH} ${GIT_REPO} /app
# Install backend dependencies
RUN uv sync --frozen --no-install-project --no-editable --extra postgresql
# Build frontend (split into steps to reduce peak memory usage)
WORKDIR /app/src/frontend
# Install dependencies first
RUN npm ci --maxsockets 1
# Build with reduced memory - 2GB should be safer for most systems
RUN NODE_OPTIONS="--max_old_space_size=2048 --max-semi-space-size=128" npm run build
# Copy built frontend
RUN mkdir -p /app/src/backend/base/langflow/frontend && \
cp -r build/* /app/src/backend/base/langflow/frontend/
# Return to app directory and install the project
WORKDIR /app
RUN uv sync --frozen --no-dev --no-editable --extra postgresql
# Expose ports
EXPOSE 7860
# Start the backend server
CMD ["uv", "run", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]