Spaces:
Sleeping
Sleeping
File size: 2,230 Bytes
8a1f753 d7b3d84 8a1f753 743b049 8a1f753 d7b3d84 8a1f753 365a149 b0e8b7b 365a149 8a1f753 d7b3d84 8a1f753 939dd28 743b049 939dd28 d7b3d84 939dd28 743b049 8a1f753 4e1982a 8a1f753 743b049 9c0e0f5 8a1f753 9c0e0f5 743b049 d7b3d84 8a1f753 743b049 0c26bda 8a1f753 743b049 8a1f753 743b049 8a1f753 d6f90da d7b3d84 8a1f753 743b049 8a1f753 743b049 8a1f753 |
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 63 64 65 66 67 68 69 70 71 72 73 |
# ============================================================
# LANDRUN + BROWSER-USE + CHROMIUM - MERGED SYSTEM
# Multi-stage build: Build landrun + Python + Browser-Use + Chromium
# ============================================================
# Stage 1: Build landrun binary from Go source
FROM golang:1.22-bookworm AS builder
WORKDIR /build
# Copy landrun source (from D:\sand\landrun-main\landrun-main)
COPY landrun-main/ ./
# Build landrun with full module context
RUN go mod download && \
go build -ldflags="-s -w" -o landrun ./cmd/landrun
# Stage 2: Production image with Python + landrun + Browser-Use + Chromium
FROM python:3.11-slim-bookworm
# Install system dependencies + compilers + browser deps
RUN apt-get update && apt-get install -y \
# Core utilities
nodejs npm curl procps strace git \
# Compilers
gcc g++ make cmake \
# Browser dependencies (Playwright Chromium)
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
libcups2 libdrm2 libxkbcommon0 libxcomposite1 \
libxdamage1 libxfixes3 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2 libatspi2.0-0 \
libxshmfence1 fonts-liberation libappindicator3-1 xdg-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy landrun binary from builder
COPY --from=builder /build/landrun /usr/local/bin/landrun
# Verify landrun works
RUN landrun --version
# Set working directory
WORKDIR /app
# Copy Python requirements and application code
COPY requirements.txt .
COPY app.py .
# Install Python dependencies (Browser-Use + Playwright + FastAPI)
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright and Chromium browser
RUN playwright install chromium --with-deps
# Create execution directory
RUN mkdir -p /tmp/sandbox && chmod 777 /tmp/sandbox
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV HOST=0.0.0.0
ENV PORT=7860
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
ENV BROWSER_USE_SETUP_LOGGING=false
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run FastAPI with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|