HMM / Dockerfile
Speedofmastery's picture
Auto-commit: Dockerfile updated
9c0e0f5
# ============================================================
# 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"]