Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

feat: Add docker support

Karim shoair8a867fc68e5b
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..be64db5
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,110 @@
+# Github
+.github/
+
+# docs
+docs/
+images/
+.cache/
+.claude/
+
+# cached files
+__pycache__/
+*.py[cod]
+.cache
+.DS_Store
+*~
+.*.sw[po]
+.build
+.ve
+.env
+.pytest
+.benchmarks
+.bootstrap
+.appveyor.token
+*.bak
+*.db
+*.db-*
+
+# installation package
+*.egg-info/
+dist/
+build/
+
+# environments
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# C extensions
+*.so
+
+# pycharm
+.idea/
+
+# vscode
+*.code-workspace
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+.eggs
+parts
+bin
+var
+sdist
+wheelhouse
+develop-eggs
+.installed.cfg
+lib
+lib64
+venv*/
+.venv*/
+pyvenv*/
+pip-wheel-metadata/
+poetry.lock
+
+# Installer logs
+pip-log.txt
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+mypy.ini
+
+# test caches
+.tox/
+.pytest_cache/
+.coverage
+htmlcov
+report.xml
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+
+# Buildout
+.mr.developer.cfg
+
+# IDE project files
+.project
+.pydevproject
+.idea
+*.iml
+*.komodoproject
+
+# Complexity
+output/*.html
+output/*/index.html
+
+# Sphinx
+docs/_build
+public/
+web/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..3524d3e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,37 @@
+FROM python:3.12-slim-trixie AS builder
+COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
+
+# Set environment variables
+ENV DEBIAN_FRONTEND=noninteractive
+ENV PYTHONUNBUFFERED=1
+ENV PYTHONDONTWRITEBYTECODE=1
+
+ADD . /app
+
+WORKDIR /app
+
+# Install dependencies
+RUN --mount=type=cache,target=/root/.cache/uv \
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
+ uv sync --no-install-project --all-extras --compile-bytecode
+
+# Install all browsers and their deps
+RUN uv run playwright install-deps chromium firefox
+RUN uv run playwright install chromium
+RUN uv run camoufox fetch --browserforge
+
+# Sync the project
+RUN --mount=type=cache,target=/root/.cache/uv \
+ uv sync --all-extras --compile-bytecode
+
+# Clean up to save space
+RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+
+# Expose port for MCP server HTTP transport
+EXPOSE 8000
+
+# Set entrypoint to run scrapling
+ENTRYPOINT ["uv", "run", "scrapling"]
+
+# Default command (can be overridden)
+CMD ["--help"]
\ No newline at end of file