langflow / Dockerfile
GraziePrego's picture
Create Dockerfile
feaca49 verified
# 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"]