SeleniumBase API: Backend for n8n-nodes-seleniumbase
563
This guide documents how to build, push, pull, and run the API image published to Docker Hub.
This image is deeply integrated with the SeleniumBase n8n node workflow and is intended to be used as the API backend for n8n automation pipelines.
Reference node package: n8n-nodes-seleniumbase
uvicorn api.api_server:app --host 0.0.0.0 --port 80008000Xvfb, cron/app/jobs, /app/artifacts, /app/attachments, /app/profiles, /app/dbexport DOCKERHUB_USER="<your-dockerhub-username>"
export IMAGE_NAME="seleniumbase-api"
export TAG="latest"
docker login
docker build -t "${DOCKERHUB_USER}/${IMAGE_NAME}:${TAG}" .
docker push "${DOCKERHUB_USER}/${IMAGE_NAME}:${TAG}"
Optional immutable tag:
export SHA_TAG="$(git rev-parse --short HEAD)"
docker tag "${DOCKERHUB_USER}/${IMAGE_NAME}:${TAG}" \
"${DOCKERHUB_USER}/${IMAGE_NAME}:${SHA_TAG}"
docker push "${DOCKERHUB_USER}/${IMAGE_NAME}:${SHA_TAG}"
mkdir -p ./data/jobs ./data/artifacts ./data/attachments ./data/profiles ./data/db
docker run -d \
--name seleniumbase-api \
-p 8000:8000 \
-v "$(pwd)/data/jobs:/app/jobs" \
-v "$(pwd)/data/artifacts:/app/artifacts" \
-v "$(pwd)/data/attachments:/app/attachments" \
-v "$(pwd)/data/profiles:/app/profiles" \
-v "$(pwd)/data/db:/app/db" \
--restart unless-stopped \
"<your-dockerhub-username>/seleniumbase-api:latest"
Create docker-compose.yml:
services:
seleniumbase-api:
image: "<your-dockerhub-username>/seleniumbase-api:latest"
container_name: seleniumbase-api
restart: unless-stopped
ports:
- "8000:8000"
environment:
JOB_TIMEOUT_SECONDS: "900"
MAX_CONCURRENT_JOBS: "5"
volumes:
- ./data/jobs:/app/jobs
- ./data/artifacts:/app/artifacts
- ./data/attachments:/app/attachments
- ./data/profiles:/app/profiles
- ./data/db:/app/db
Start:
mkdir -p ./data/jobs ./data/artifacts ./data/attachments ./data/profiles ./data/db
docker compose up -d
Useful commands:
docker compose logs -f seleniumbase-api
docker compose pull
docker compose up -d
docker compose down
curl http://localhost:8000/health
Expected JSON includes status: "healthy".
GET /healthPOST /attachmentsGET /attachmentsGET /attachments/{attachment_id}POST /submitGET /status/{job_id}GET /result/{job_id}GET /artifacts/{job_id}/{filename}DELETE /job/{job_id}GET /jobsGET /profilesDELETE /profile/{profile_name}Interactive docs are also available at http://localhost:8000/docs.
BASE_DIR (default: current working directory, /app in this image)DB_PATH (default: ${BASE_DIR}/db/seleniumbase_api.db)JOBS_DIR (default: ${BASE_DIR}/jobs)ARTIFACTS_DIR (default: ${BASE_DIR}/artifacts)ATTACHMENTS_DIR (default: ${BASE_DIR}/attachments)PROFILES_DIR (default: ${BASE_DIR}/profiles)ATTACHMENT_TTL_SECONDS (default: 3600)ATTACHMENT_MAX_SIZE_BYTES (default: 52428800)JOB_TIMEOUT_SECONDS (default: 600)MAX_CONCURRENT_JOBS (default: 3)Example overrides:
docker run -d \
--name seleniumbase-api \
-p 8000:8000 \
-e JOB_TIMEOUT_SECONDS=900 \
-e MAX_CONCURRENT_JOBS=5 \
"<your-dockerhub-username>/seleniumbase-api:latest"
Submit a simple job:
curl -X POST "http://localhost:8000/submit" \
-H "Content-Type: application/json" \
-d '{"script":"from seleniumbase import SB\nwith SB(test=True, uc=True) as sb:\n sb.open(\"https://example.com\")\n print(sb.get_title())","params":{}}'
Then poll status:
curl "http://localhost:8000/status/<job_id>"
curl "http://localhost:8000/result/<job_id>"
Content type
Image
Digest
sha256:166a9a4d3…
Size
481.7 MB
Last updated
7 months ago
docker pull tranlight/seleniumbase-api