Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Git
.git
.gitignore

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
.eggs/
dist/
build/
*.egg

# Virtual environments
.venv/
venv/
ENV/

# IDE
.idea/
.vscode/
*.swp
*.swo

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/

# Playwright
playwright-report/
test-results/

# Environment
.env
.env.local
.env.*.local

# Output
output/
screenshots/
*.png
*.jpg

# Docs (keep in image if needed)
# docs/

# Tests (not needed in production image)
tests/

# Misc
*.log
*.tmp
.DS_Store
Thumbs.db
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ __pycache__/
.vscode/
playwright-report/
test-results/

# Environment variables (NEVER commit!)
.env
.env.local
.env.*.local
118 changes: 86 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,86 @@
FROM Comingsoon
# FROM python:3.11-slim AS builder

# WORKDIR /app

# RUN apt-get update && apt-get install -y --no-install-recommends \
# wget \
# gnupg \
# ca-certificates \
# fonts-liberation \
# libasound2 \
# libatk-bridge2.0-0 \
# libatk1.0-0 \
# libatspi2.0-0 \
# libcups2 \
# libdbus-1-3 \
# libdrm2 \
# libgbm1 \
# libgtk-3-0 \
# libnspr4 \
# libnss3 \
# libwayland-client0 \
# libxcomposite1 \
# libxdamage1 \
# libxfixes3 \
# libxkbcommon0 \
# libxrandr2 \
# xdg-utils \
# && rm -rf /var/lib/apt/lists/*
# COPY pyproject.toml .

# RUN uv sync
# Multi-stage Dockerfile for Autonomous Browser AI Agent
# Stage 1: Build dependencies
FROM python:3.11-slim AS builder

WORKDIR /app

# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"

# Copy dependency files
COPY pyproject.toml uv.lock ./

# Install Python dependencies
RUN uv sync --frozen --no-dev

# Stage 2: Runtime
FROM python:3.11-slim AS runtime

WORKDIR /app

# Install Playwright dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# Playwright dependencies
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libdbus-1-3 \
libatspi2.0-0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libxkbcommon0 \
libasound2 \
libpango-1.0-0 \
libcairo2 \
# Fonts
fonts-liberation \
fonts-noto-color-emoji \
# Utilities
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Install uv
COPY --from=builder /root/.local/bin/uv /usr/local/bin/uv

# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV VIRTUAL_ENV="/app/.venv"

# Copy source code
COPY src/ ./src/
COPY pyproject.toml ./

# Install Playwright browsers
RUN playwright install chromium

# Create non-root user for security
RUN useradd -m -u 1000 agent
RUN chown -R agent:agent /app
USER agent

# Environment variables (override at runtime)
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV BROWSER_HEADLESS=true

# Default command
ENTRYPOINT ["python", "-m", "src"]
CMD ["--help"]

# Example usage:
# docker build -t browser-agent .
# docker run -e GEMINI_API_KEY=xxx browser-agent --url "https://example.com" --task "extract title"
Loading