File size: 1,279 Bytes
feaca49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    LANGFLOW_HOST=0.0.0.0 \
    LANGFLOW_PORT=7860 \
    HOME=/home/user

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user for Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
WORKDIR $HOME/app

# Clone the repository directly into the app directory
RUN git clone https://huggingface.co/spaces/Leon4gr45/OpenLangflow .

# Install dependencies
# We upgrade pip first and then install requirements
RUN pip install --no-cache-dir --upgrade pip && \
    if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi

# Install langflow specifically (in case it's not in requirements)
RUN pip install --no-cache-dir langflow

# Set permissions (Hugging Face specific)
# Ensure the user has access to their own home directory
RUN chmod -R 777 $HOME/app

# Expose the port Langflow will run on
EXPOSE 7860

# Command to run the application
# We use the specific host and port required by Hugging Face
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]