Speedofmastery commited on
Commit
786ab2f
·
1 Parent(s): 6a43979

Auto-commit: Dockerfile_enhanced updated

Browse files
Files changed (1) hide show
  1. Dockerfile_enhanced +81 -0
Dockerfile_enhanced ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ============================================================
2
+ # LANDRUN + BROWSER-USE + CHROMIUM - MERGED SYSTEM
3
+ # Multi-stage build: Build landrun + Python + Browser-Use + Chromium
4
+ # ============================================================
5
+
6
+ # Stage 1: Build landrun binary from Go source
7
+ FROM golang:1.22-bookworm AS builder
8
+
9
+ WORKDIR /build
10
+
11
+ # Copy landrun source (from D:\sand\landrun-main\landrun-main)
12
+ COPY landrun-main/ ./
13
+
14
+ # Build landrun with full module context
15
+ RUN go mod download && \
16
+ go build -ldflags="-s -w" -o landrun ./cmd/landrun
17
+
18
+ # Stage 2: Production image with Python + landrun + Browser-Use + Chromium
19
+ FROM python:3.11-slim-bookworm
20
+
21
+ # Install system dependencies + compilers + browser deps
22
+ RUN apt-get update && apt-get install -y \
23
+ # Core utilities
24
+ nodejs npm curl procps strace git \
25
+ # Compilers
26
+ gcc g++ make cmake \
27
+ # Browser dependencies (Playwright Chromium)
28
+ libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
29
+ libcups2 libdrm2 libxkbcommon0 libxcomposite1 \
30
+ libxdamage1 libxfixes3 libxrandr2 libgbm1 \
31
+ libpango-1.0-0 libcairo2 libasound2 libatspi2.0-0 \
32
+ libxshmfence1 fonts-liberation libappindicator3-1 xdg-utils \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ # Copy landrun binary from builder
36
+ COPY --from=builder /build/landrun /usr/local/bin/landrun
37
+
38
+ # Verify landrun works
39
+ RUN landrun --version
40
+
41
+ # Set working directory
42
+ WORKDIR /app
43
+
44
+ # Copy Browser-Use source (from D:\sand\landrun-main\browser-use-main)
45
+ COPY browser-use-main/browser_use ./browser_use
46
+ COPY browser-use-main/pyproject.toml ./
47
+
48
+ # Copy Python requirements
49
+ COPY requirements.txt .
50
+
51
+ # Install Python dependencies (Browser-Use + Playwright + FastAPI)
52
+ RUN pip install --no-cache-dir -r requirements.txt
53
+
54
+ # Install Browser-Use in editable mode
55
+ RUN pip install -e .
56
+
57
+ # Install Playwright and Chromium browser
58
+ RUN playwright install chromium --with-deps
59
+
60
+ # Copy application code
61
+ COPY app_enhanced.py ./app.py
62
+
63
+ # Create execution directory
64
+ RUN mkdir -p /tmp/sandbox && chmod 777 /tmp/sandbox
65
+
66
+ # Expose port for Hugging Face Spaces
67
+ EXPOSE 7860
68
+
69
+ # Set environment variables
70
+ ENV PYTHONUNBUFFERED=1
71
+ ENV HOST=0.0.0.0
72
+ ENV PORT=7860
73
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
74
+ ENV BROWSER_USE_SETUP_LOGGING=false
75
+
76
+ # Health check
77
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
78
+ CMD curl -f http://localhost:7860/health || exit 1
79
+
80
+ # Run FastAPI with uvicorn
81
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]