├── python ├── .dockerignore ├── src │ ├── __main__.py │ └── main.py └── Dockerfile ├── python-playwright ├── .dockerignore ├── start_xvfb_and_run_cmd.sh ├── src │ ├── __main__.py │ └── main.py ├── xvfb-entrypoint.sh └── Dockerfile ├── python-selenium ├── .dockerignore ├── start_xvfb_and_run_cmd.sh ├── src │ ├── __main__.py │ └── main.py ├── xvfb-entrypoint.sh └── Dockerfile ├── .eslintrc.json ├── node-playwright ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── register_intermediate_certs.sh ├── package.json ├── chrome_test.js ├── check-playwright-version.mjs ├── main.js └── Dockerfile ├── .gitignore ├── node-puppeteer-chrome ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── package.json ├── puppeteer_chrome_test.js ├── check-puppeteer-version.mjs ├── main.js └── Dockerfile ├── node-playwright-camoufox ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── register_intermediate_certs.sh ├── package.json ├── firefox_test.js ├── main.js ├── check-playwright-version.mjs └── Dockerfile ├── node-playwright-chrome ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── package.json ├── chrome_test.js ├── check-playwright-version.mjs ├── main.js └── Dockerfile ├── node-playwright-firefox ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── register_intermediate_certs.sh ├── package.json ├── firefox_test.js ├── main.js ├── check-playwright-version.mjs └── Dockerfile ├── node-playwright-webkit ├── new_xvfb_run_cmd.sh ├── start_xvfb_and_run_cmd.sh ├── .dockerignore ├── xvfb-entrypoint.sh ├── package.json ├── webkit_test.js ├── main.js ├── check-playwright-version.mjs └── Dockerfile ├── node ├── .dockerignore ├── package.json ├── main.js └── Dockerfile ├── node-phantomjs ├── .dockerignore ├── test.js └── Dockerfile ├── .github ├── actions │ └── version-matrix │ │ ├── .yarnrc.yml │ │ ├── .editorconfig │ │ ├── src │ │ ├── shared │ │ │ ├── constants.ts │ │ │ ├── npm.ts │ │ │ ├── pypi.ts │ │ │ └── cache.ts │ │ └── matrices │ │ │ ├── python │ │ │ ├── normal.ts │ │ │ ├── selenium.ts │ │ │ └── playwright.ts │ │ │ └── node │ │ │ ├── normal.ts │ │ │ ├── puppeteer.ts │ │ │ └── playwright.ts │ │ ├── tsconfig.json │ │ ├── package.json │ │ ├── data │ │ ├── cache-states-beta.json │ │ └── cache-states-latest.json │ │ ├── .gitignore │ │ └── README.md ├── scripts │ ├── prepare-node-image-tags.js │ ├── prepare-python-image-tags.js │ └── set-dependency-versions.js └── workflows │ ├── release-python.yaml │ ├── release-python-selenium.yaml │ ├── release-python-playwright.yaml │ ├── release-node.yaml │ ├── release-node-puppeteer.yaml │ └── release-node-playwright.yaml ├── .editorconfig ├── renovate.json ├── .vscode └── settings.json ├── biome.json ├── release-process.md ├── node-playwright.md ├── scripts └── update-package-json.mjs ├── README.md ├── Makefile └── LICENSE /python/.dockerignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | -------------------------------------------------------------------------------- /python-playwright/.dockerignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | -------------------------------------------------------------------------------- /python-selenium/.dockerignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@apify" 3 | } 4 | -------------------------------------------------------------------------------- /node-playwright/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | npm-debug.log 3 | node_modules 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /node-playwright/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /python-selenium/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-camoufox/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-chrome/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-firefox/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-webkit/new_xvfb_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /python-playwright/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-camoufox/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-chrome/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-firefox/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-playwright-webkit/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/start_xvfb_and_run_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /node-phantomjs/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-playwright/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-playwright-camoufox/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-playwright-chrome/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-playwright-firefox/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-playwright-webkit/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /node-puppeteer-chrome/.dockerignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | yarn.lock 3 | node_modules 4 | .gitignore -------------------------------------------------------------------------------- /python-selenium/src/__main__.py: -------------------------------------------------------------------------------- 1 | from .main import main 2 | 3 | try: 4 | main() 5 | except Exception: 6 | print('Test failed!') 7 | raise 8 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | compressionLevel: mixed 2 | 3 | enableGlobalCache: true 4 | 5 | nodeLinker: node-modules 6 | 7 | yarnPath: .yarn/releases/yarn-4.12.0.cjs 8 | -------------------------------------------------------------------------------- /python-playwright/src/__main__.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from .main import main 4 | 5 | try: 6 | asyncio.run(main()) 7 | except Exception: 8 | print('Test failed!') 9 | raise 10 | -------------------------------------------------------------------------------- /node-playwright/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /python-selenium/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /python-playwright/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /node-playwright-camoufox/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /node-playwright-chrome/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /node-playwright-firefox/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /node-playwright-webkit/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/xvfb-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" 4 | xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | # editorconfig-tools is unable to ignore longs strings or urls 11 | max_line_length = null 12 | 13 | [{*.yaml, *.yml}] 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tabs 5 | indent_size = 4 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | # editorconfig-tools is unable to ignore longs strings or urls 11 | max_line_length = null 12 | quote_type = single 13 | 14 | [*.md] 15 | indent_size = 2 16 | 17 | [*.yml] 18 | indent_size = 4 19 | 20 | [*.yaml] 21 | indent_size = 4 22 | -------------------------------------------------------------------------------- /python/src/__main__.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | 4 | from apify.log import ActorLogFormatter 5 | 6 | from .main import main 7 | 8 | print('Testing Docker image...') 9 | 10 | handler = logging.StreamHandler() 11 | handler.setFormatter(ActorLogFormatter()) 12 | 13 | apify_client_logger = logging.getLogger('apify_client') 14 | apify_client_logger.setLevel(logging.INFO) 15 | apify_client_logger.addHandler(handler) 16 | 17 | apify_logger = logging.getLogger('apify') 18 | apify_logger.setLevel(logging.DEBUG) 19 | apify_logger.addHandler(handler) 20 | 21 | asyncio.run(main()) 22 | -------------------------------------------------------------------------------- /node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "typescript": "^5.4.3" 13 | }, 14 | "overrides": { 15 | "apify": { 16 | "@crawlee/core": "CRAWLEE_VERSION", 17 | "@crawlee/types": "CRAWLEE_VERSION", 18 | "@crawlee/utils": "CRAWLEE_VERSION" 19 | } 20 | }, 21 | "repository": {} 22 | } 23 | -------------------------------------------------------------------------------- /python/src/main.py: -------------------------------------------------------------------------------- 1 | # This file will be replaced by the actual actor source code, 2 | # we keep this one here just for testing and clarification. 3 | 4 | from apify import Actor 5 | 6 | 7 | async def main(): 8 | async with Actor: 9 | print('Testing Docker image...') 10 | try: 11 | assert Actor.configuration.is_at_home is False 12 | 13 | apify_user = await Actor.apify_client.user('apify').get() 14 | assert apify_user is not None 15 | assert apify_user.get('username') == 'apify' 16 | print('Test successful') 17 | except: 18 | print('Test failed') 19 | raise 20 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/shared/constants.ts: -------------------------------------------------------------------------------- 1 | export const supportedPythonVersions = ['3.10', '3.11', '3.12', '3.13', '3.14']; 2 | 3 | export const supportedNodeVersions = ['20', '22', '24']; 4 | 5 | export const shouldUseLastFive = process.env.SHOULD_USE_LAST_FIVE === 'true'; 6 | 7 | export const emptyMatrix = JSON.stringify({ include: [] }); 8 | 9 | /** 10 | * The version of Python to be considered as the "default" version for the built image tags. 11 | */ 12 | export const latestPythonVersion = '3.14'; 13 | 14 | /** 15 | * The version of Node to be considered as the "default" version for the built image tags. 16 | */ 17 | export const latestNodeVersion = '22'; 18 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | ":semanticCommitTypeAll(chore)", 6 | "docker:disable" 7 | ], 8 | "semanticCommits": "enabled", 9 | "lockFileMaintenance": { 10 | "enabled": true, 11 | "automerge": true, 12 | "automergeType": "branch" 13 | }, 14 | "packageRules": [ 15 | { 16 | "matchUpdateTypes": ["patch", "minor"], 17 | "matchCurrentVersion": "!/^0/", 18 | "groupName": "patch/minor dependencies", 19 | "groupSlug": "all-non-major", 20 | "automerge": true, 21 | "automergeType": "branch" 22 | } 23 | ], 24 | "schedule": ["every weekday"] 25 | } 26 | -------------------------------------------------------------------------------- /node-playwright/register_intermediate_certs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILENAMES=$(wget -O - https://firefox.settings.services.mozilla.com/v1/buckets/security-state/collections/intermediates/records | jq -r '.data[].attachment.location') 4 | 5 | mkdir -p /usr/local/share/ca-certificates/firefox 6 | 7 | wget -P "/usr/local/share/ca-certificates/firefox/" -i <(echo $FILENAMES | tr ' ' '\n' | sed -e 's/^/https:\/\/firefox-settings-attachments.cdn.mozilla.net\//g') 8 | 9 | for f in /usr/local/share/ca-certificates/firefox/*.pem; do 10 | mv -- "$f" "${f%.pem}.crt" 11 | done 12 | 13 | chmod 644 /usr/local/share/ca-certificates/firefox/*.crt 14 | chmod 755 /usr/local/share/ca-certificates/firefox 15 | 16 | update-ca-certificates -------------------------------------------------------------------------------- /node-playwright-firefox/register_intermediate_certs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILENAMES=$(wget -O - https://firefox.settings.services.mozilla.com/v1/buckets/security-state/collections/intermediates/records | jq -r '.data[].attachment.location') 4 | 5 | mkdir -p /usr/local/share/ca-certificates/firefox 6 | 7 | wget -P "/usr/local/share/ca-certificates/firefox/" -i <(echo $FILENAMES | tr ' ' '\n' | sed -e 's/^/https:\/\/firefox-settings-attachments.cdn.mozilla.net\//g') 8 | 9 | for f in /usr/local/share/ca-certificates/firefox/*.pem; do 10 | mv -- "$f" "${f%.pem}.crt" 11 | done 12 | 13 | chmod 644 /usr/local/share/ca-certificates/firefox/*.crt 14 | chmod 755 /usr/local/share/ca-certificates/firefox 15 | 16 | update-ca-certificates -------------------------------------------------------------------------------- /node-playwright/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Chrome)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "playwright": "PLAYWRIGHT_VERSION", 13 | "typescript": "^5.4.3" 14 | }, 15 | "overrides": { 16 | "apify": { 17 | "@crawlee/core": "CRAWLEE_VERSION", 18 | "@crawlee/types": "CRAWLEE_VERSION", 19 | "@crawlee/utils": "CRAWLEE_VERSION" 20 | } 21 | }, 22 | "repository": {} 23 | } 24 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[javascript]": { 3 | "editor.defaultFormatter": "biomejs.biome" 4 | }, 5 | "[javascriptreact]": { 6 | "editor.defaultFormatter": "esbenp.prettier-vscode" 7 | }, 8 | "[json]": { 9 | "editor.defaultFormatter": "biomejs.biome" 10 | }, 11 | "[typescript]": { 12 | "editor.defaultFormatter": "biomejs.biome" 13 | }, 14 | "[typescriptreact]": { 15 | "editor.defaultFormatter": "biomejs.biome" 16 | }, 17 | "[jsonc]": { 18 | "editor.defaultFormatter": "biomejs.biome" 19 | }, 20 | "[yaml]": { 21 | "editor.defaultFormatter": "biomejs.biome" 22 | }, 23 | "[markdown]": { 24 | "editor.defaultFormatter": "esbenp.prettier-vscode", 25 | "files.trimTrailingWhitespace": false 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /node-playwright-camoufox/register_intermediate_certs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILENAMES=$(wget -O - https://firefox.settings.services.mozilla.com/v1/buckets/security-state/collections/intermediates/records | jq -r '.data[].attachment.location') 4 | 5 | mkdir -p /usr/local/share/ca-certificates/firefox 6 | 7 | wget -P "/usr/local/share/ca-certificates/firefox/" -i <(echo $FILENAMES | tr ' ' '\n' | sed -e 's/^/https:\/\/firefox-settings-attachments.cdn.mozilla.net\//g') 8 | 9 | for f in /usr/local/share/ca-certificates/firefox/*.pem; do 10 | mv -- "$f" "${f%.pem}.crt" 11 | done 12 | 13 | chmod 644 /usr/local/share/ca-certificates/firefox/*.crt 14 | chmod 755 /usr/local/share/ca-certificates/firefox 15 | 16 | update-ca-certificates -------------------------------------------------------------------------------- /node-puppeteer-chrome/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Chrome)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "puppeteer": "PUPPETEER_VERSION", 13 | "typescript": "^5.4.3" 14 | }, 15 | "overrides": { 16 | "apify": { 17 | "@crawlee/core": "CRAWLEE_VERSION", 18 | "@crawlee/types": "CRAWLEE_VERSION", 19 | "@crawlee/utils": "CRAWLEE_VERSION" 20 | } 21 | }, 22 | "repository": {} 23 | } 24 | -------------------------------------------------------------------------------- /node-playwright-chrome/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Chrome)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "playwright-chromium": "PLAYWRIGHT_VERSION", 13 | "typescript": "^5.4.3" 14 | }, 15 | "overrides": { 16 | "apify": { 17 | "@crawlee/core": "CRAWLEE_VERSION", 18 | "@crawlee/types": "CRAWLEE_VERSION", 19 | "@crawlee/utils": "CRAWLEE_VERSION" 20 | } 21 | }, 22 | "repository": {} 23 | } 24 | -------------------------------------------------------------------------------- /node-playwright-firefox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Firefox)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "playwright-firefox": "PLAYWRIGHT_VERSION", 13 | "typescript": "^5.4.3" 14 | }, 15 | "overrides": { 16 | "apify": { 17 | "@crawlee/core": "CRAWLEE_VERSION", 18 | "@crawlee/types": "CRAWLEE_VERSION", 19 | "@crawlee/utils": "CRAWLEE_VERSION" 20 | } 21 | }, 22 | "repository": {} 23 | } 24 | -------------------------------------------------------------------------------- /node-playwright-webkit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Webkit)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "crawlee": "CRAWLEE_VERSION", 12 | "playwright-webkit": "PLAYWRIGHT_VERSION", 13 | "typescript": "^5.4.3" 14 | }, 15 | "overrides": { 16 | "apify": { 17 | "@crawlee/core": "CRAWLEE_VERSION", 18 | "@crawlee/types": "CRAWLEE_VERSION", 19 | "@crawlee/utils": "CRAWLEE_VERSION" 20 | } 21 | }, 22 | "repository": {} 23 | } 24 | -------------------------------------------------------------------------------- /node-phantomjs/test.js: -------------------------------------------------------------------------------- 1 | // This code is used to test that both Node.js and PhantomJS work. 2 | 3 | const { exec } = require('child_process'); 4 | 5 | /* global process */ 6 | 7 | console.log('Testing PhantomJS...'); 8 | 9 | exec('phantomjs --version', (error, stdout, stderr) => { 10 | if (error) { 11 | console.error(`exec error: ${error}`); 12 | process.exit(1); 13 | } 14 | 15 | console.log('Version:', stdout); 16 | 17 | if (stdout.trim() !== '2.1.1s-apifier') { 18 | throw new Error(`Unsupported version of PhantomJS: ${stdout}`); 19 | } 20 | if (stderr.trim()) { 21 | throw new Error(`Unknown error occurred: ${stderr}`); 22 | } 23 | 24 | console.log('... test PASSED'); 25 | }); 26 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | // Enable latest features 4 | "lib": ["ESNext", "DOM"], 5 | "target": "ESNext", 6 | "module": "NodeNext", 7 | "moduleDetection": "force", 8 | "allowJs": true, 9 | 10 | // Bundler mode 11 | "moduleResolution": "NodeNext", 12 | "allowImportingTsExtensions": true, 13 | "verbatimModuleSyntax": true, 14 | "noEmit": true, 15 | 16 | // Best practices 17 | "strict": true, 18 | "skipLibCheck": true, 19 | "noFallthroughCasesInSwitch": true, 20 | 21 | // Some stricter flags (disabled by default) 22 | "noUnusedLocals": false, 23 | "noUnusedParameters": false, 24 | "noPropertyAccessFromIndexSignature": false 25 | }, 26 | "include": ["src/**/*.ts"] 27 | } 28 | -------------------------------------------------------------------------------- /node-playwright-camoufox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Anonymous actor on the Apify platform (with Firefox)", 3 | "version": "0.0.1", 4 | "license": "UNLICENSED", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "node main.js" 8 | }, 9 | "dependencies": { 10 | "apify": "APIFY_VERSION", 11 | "camoufox-js": "CAMOUFOX_VERSION", 12 | "crawlee": "CRAWLEE_VERSION", 13 | "impit": "latest", 14 | "playwright": "PLAYWRIGHT_VERSION", 15 | "typescript": "^5.4.3" 16 | }, 17 | "overrides": { 18 | "apify": { 19 | "@crawlee/core": "CRAWLEE_VERSION", 20 | "@crawlee/types": "CRAWLEE_VERSION", 21 | "@crawlee/utils": "CRAWLEE_VERSION" 22 | } 23 | }, 24 | "repository": {} 25 | } 26 | -------------------------------------------------------------------------------- /biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "javascript": { 4 | "formatter": { 5 | "quoteStyle": "single", 6 | "semicolons": "always", 7 | "trailingCommas": "all", 8 | "lineWidth": 120, 9 | "indentStyle": "tab", 10 | "indentWidth": 4, 11 | "quoteProperties": "preserve", 12 | "lineEnding": "lf" 13 | } 14 | }, 15 | "linter": { 16 | "enabled": false, 17 | "rules": { 18 | "style": { 19 | "noParameterAssign": "error", 20 | "useAsConstAssertion": "error", 21 | "useDefaultParameterLast": "error", 22 | "useEnumInitializers": "error", 23 | "useSelfClosingElements": "error", 24 | "useSingleVarDeclarator": "error", 25 | "noUnusedTemplateLiteral": "error", 26 | "useNumberNamespace": "error", 27 | "noInferrableTypes": "error", 28 | "noUselessElse": "error" 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /node-playwright-chrome/chrome_test.js: -------------------------------------------------------------------------------- 1 | const { launchPlaywright } = require('crawlee'); 2 | 3 | const testPageLoading = async (browser) => { 4 | const page = await browser.newPage(); 5 | await page.goto('http://www.example.com'); 6 | const pageTitle = await page.title(); 7 | if (pageTitle !== 'Example Domain') { 8 | throw new Error(`Playwright+Chrome test failed - returned title "${pageTitle}"" !== "Example Domain"`); 9 | } 10 | }; 11 | 12 | const testChrome = async (launchOptions) => { 13 | const launchContext = { useChrome: true, launchOptions }; 14 | 15 | console.log(`Testing Playwright with Chrome`, launchContext); 16 | 17 | const browser = await launchPlaywright(launchContext); 18 | 19 | await testPageLoading(browser); 20 | await browser.close(); 21 | }; 22 | 23 | module.exports = { 24 | testChrome, 25 | }; 26 | -------------------------------------------------------------------------------- /node-playwright/chrome_test.js: -------------------------------------------------------------------------------- 1 | const { launchPlaywright } = require('crawlee'); 2 | 3 | const testPageLoading = async (browser) => { 4 | const page = await browser.newPage(); 5 | await page.goto('http://www.example.com'); 6 | const pageTitle = await page.title(); 7 | if (pageTitle !== 'Example Domain') { 8 | throw new Error(`Playwright+Chrome test failed - returned title "${pageTitle}"" !== "Example Domain"`); 9 | } 10 | }; 11 | 12 | const testChrome = async (launchOptions) => { 13 | const launchContext = { useChrome: true, launchOptions }; 14 | 15 | console.log(`Testing Playwright with Chrome`, launchContext); 16 | 17 | const browser = await launchPlaywright(launchContext); 18 | 19 | await testPageLoading(browser); 20 | await browser.close(); 21 | }; 22 | 23 | module.exports = { 24 | testChrome, 25 | testPageLoading, 26 | }; 27 | -------------------------------------------------------------------------------- /node-playwright-webkit/webkit_test.js: -------------------------------------------------------------------------------- 1 | const { launchPlaywright } = require('crawlee'); 2 | 3 | const testPageLoading = async (browser) => { 4 | const page = await browser.newPage(); 5 | await page.goto('http://www.example.com'); 6 | const pageTitle = await page.title(); 7 | if (pageTitle !== 'Example Domain') { 8 | throw new Error(`Playwright+Webkit test failed - returned title "${pageTitle}"" !== "Example Domain"`); 9 | } 10 | }; 11 | 12 | const testWebkit = async (launchOptions) => { 13 | const launchContext = { 14 | launcher: require('playwright').webkit, 15 | launchOptions, 16 | }; 17 | 18 | console.log(`Testing Playwright with Webkit`, launchOptions); 19 | 20 | const browser = await launchPlaywright(launchContext); 21 | 22 | await testPageLoading(browser); 23 | await browser.close(); 24 | }; 25 | 26 | module.exports = testWebkit; 27 | -------------------------------------------------------------------------------- /node-playwright-firefox/firefox_test.js: -------------------------------------------------------------------------------- 1 | const { launchPlaywright } = require('crawlee'); 2 | 3 | const testPageLoading = async (browser) => { 4 | const page = await browser.newPage(); 5 | await page.goto('http://www.example.com'); 6 | const pageTitle = await page.title(); 7 | if (pageTitle !== 'Example Domain') { 8 | throw new Error(`Playwright+Firefox test failed - returned title "${pageTitle}"" !== "Example Domain"`); 9 | } 10 | }; 11 | 12 | const testFirefox = async (launchOptions) => { 13 | const launchContext = { 14 | launcher: require('playwright').firefox, 15 | launchOptions, 16 | }; 17 | 18 | console.log(`Testing Playwright with Firefox`, launchOptions); 19 | 20 | const browser = await launchPlaywright(launchContext); 21 | 22 | await testPageLoading(browser); 23 | await browser.close(); 24 | }; 25 | 26 | module.exports = testFirefox; 27 | -------------------------------------------------------------------------------- /python-playwright/src/main.py: -------------------------------------------------------------------------------- 1 | from playwright.async_api import async_playwright 2 | 3 | 4 | async def run_test(launcher, headless=True): 5 | print(f'Testing {launcher.name} with {headless=}') 6 | browser = await launcher.launch(headless=headless) 7 | page = await browser.new_page() 8 | await page.goto('http://example.com') 9 | if 'Example Domain' != await page.title(): 10 | raise Exception(f'Playwright failed to load! ({launcher.name}, {headless=})') 11 | await browser.close() 12 | 13 | 14 | async def main(): 15 | async with async_playwright() as playwright: 16 | print('Testing docker image by opening browsers...') 17 | for launcher in [playwright.firefox, playwright.chromium, playwright.webkit]: 18 | await run_test(launcher, headless=True) 19 | await run_test(launcher, headless=False) 20 | print('Testing finished successfully.') 21 | -------------------------------------------------------------------------------- /node/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { getMemoryInfo } = require('crawlee'); 16 | 17 | Actor.main(async () => { 18 | // Test that "ps" command is available, sometimes it was missing in official Node builds 19 | await getMemoryInfo(); 20 | 21 | console.log('... test PASSED'); 22 | }); 23 | -------------------------------------------------------------------------------- /python-selenium/src/main.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver.chrome.options import Options as ChromeOptions 2 | from selenium.webdriver.firefox.options import Options as FirefoxOptions 3 | from selenium import webdriver 4 | 5 | def main(): 6 | print('Testing Docker image...') 7 | 8 | for (browser_name, driver_class, options_class) in [('Chrome', webdriver.Chrome, ChromeOptions), ('Firefox', webdriver.Firefox, FirefoxOptions)]: 9 | for headless in [True, False]: 10 | print(f'Testing {browser_name}, {headless=}...') 11 | 12 | options = options_class() 13 | options.add_argument('--no-sandbox') 14 | options.add_argument('--disable-dev-shm-usage') 15 | if headless: 16 | options.add_argument('--headless') 17 | 18 | driver = driver_class(options=options) 19 | 20 | driver.get('http://www.example.com') 21 | assert driver.title == 'Example Domain' 22 | 23 | driver.quit() 24 | 25 | print('Tests succeeded!') 26 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "python-matrix", 3 | "type": "module", 4 | "private": true, 5 | "scripts": { 6 | "python:normal": "node src/matrices/python/normal.ts", 7 | "python:playwright": "node src/matrices/python/playwright.ts", 8 | "python:selenium": "node src/matrices/python/selenium.ts", 9 | "node:normal": "node src/matrices/node/normal.ts", 10 | "node:puppeteer": "node src/matrices/node/puppeteer.ts", 11 | "node:playwright": "node src/matrices/node/playwright.ts", 12 | "fmt": "biome format --write . && biome format --write ../../../renovate.json", 13 | "typecheck": "tsc --noEmit" 14 | }, 15 | "devDependencies": { 16 | "@biomejs/biome": "^2.0.0", 17 | "@types/node": "^24.0.0", 18 | "@types/semver": "^7.7.0", 19 | "typescript": "^5.8.3" 20 | }, 21 | "dependencies": { 22 | "@actions/core": "^1.11.1", 23 | "@actions/github": "^6.0.1", 24 | "semver": "^7.7.2" 25 | }, 26 | "volta": { 27 | "node": "24.12.0", 28 | "yarn": "4.12.0" 29 | }, 30 | "packageManager": "yarn@4.12.0" 31 | } 32 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/shared/npm.ts: -------------------------------------------------------------------------------- 1 | import { compare } from 'semver'; 2 | 3 | const npmPackageInfoRoute = (pkg: string) => `https://registry.npmjs.org/${pkg}`; 4 | 5 | interface PackageVersionInfo { 6 | name: string; 7 | version: string; 8 | engines?: Record; 9 | } 10 | 11 | interface PackageInfo { 12 | name: string; 13 | 'dist-tags': Record; 14 | versions: Record; 15 | } 16 | 17 | export async function fetchPackageVersions(packageName: string) { 18 | const url = npmPackageInfoRoute(packageName); 19 | 20 | const response = await fetch(url); 21 | 22 | if (!response.ok) { 23 | throw new Error(`Failed to fetch package info for ${packageName}`, { 24 | cause: await response.text(), 25 | }); 26 | } 27 | 28 | const json: PackageInfo = await response.json(); 29 | 30 | // Avoid versions with suffixes for this 31 | const versions = Object.keys(json.versions).filter((version) => !/[a-z]/.test(version)); 32 | 33 | return versions.sort((a, b) => compare(a, b)); 34 | } 35 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/puppeteer_chrome_test.js: -------------------------------------------------------------------------------- 1 | const { launchPuppeteer } = require('crawlee'); 2 | 3 | const testPageLoading = async (browser) => { 4 | const page = await browser.newPage(); 5 | await page.goto('http://www.example.com'); 6 | const pageTitle = await page.title(); 7 | if (pageTitle !== 'Example Domain') { 8 | throw new Error(`Puppeteer+Chrome test failed - returned title "${pageTitle}"" !== "Example Domain"`); 9 | } 10 | }; 11 | 12 | const testPuppeteerChrome = async () => { 13 | console.log('Testing Puppeteer with full Chrome'); 14 | // We need --no-sandbox, because even though the build is running on GitHub, the test is running in Docker. 15 | const launchOptions = { headless: true, args: ['--no-sandbox'] }; 16 | const launchContext = { useChrome: true, launchOptions }; 17 | 18 | const browser = await launchPuppeteer(launchContext); 19 | try { 20 | await testPageLoading(browser); 21 | } finally { 22 | await browser.close(); 23 | } 24 | }; 25 | 26 | module.exports = testPuppeteerChrome; 27 | -------------------------------------------------------------------------------- /node-playwright-camoufox/firefox_test.js: -------------------------------------------------------------------------------- 1 | const { launchPlaywright } = require('crawlee'); 2 | const { launchOptions: camoufoxLaunchOptions } = require('camoufox-js'); 3 | 4 | const testPageLoading = async (browser) => { 5 | const page = await browser.newPage(); 6 | await page.goto('http://www.example.com'); 7 | const pageTitle = await page.title(); 8 | if (pageTitle !== 'Example Domain') { 9 | throw new Error(`Playwright+Firefox test failed - returned title "${pageTitle}"" !== "Example Domain"`); 10 | } 11 | }; 12 | 13 | const testFirefox = async (launchOptions) => { 14 | const launchContext = { 15 | launcher: require('playwright').firefox, 16 | launchOptions: await camoufoxLaunchOptions({ 17 | ...launchOptions, 18 | }), 19 | }; 20 | 21 | console.log(`Testing Playwright with Firefox`, launchContext.launchOptions); 22 | 23 | const browser = await launchPlaywright(launchContext); 24 | 25 | await testPageLoading(browser); 26 | await browser.close(); 27 | }; 28 | 29 | module.exports = testFirefox; 30 | -------------------------------------------------------------------------------- /release-process.md: -------------------------------------------------------------------------------- 1 | # Docker images release process 2 | 3 | This short readme covers the apify docker images release process. 4 | 5 | ## Node images 6 | The latest version of `apify/actor-node` is released with the `latest` tag (with the latest node) and corresponding node version tag, such as `14`. This means that the images tagged with the newest node version and the `latest` tag are the same. Suppose the release is triggered with any other tag such as `beta`. The resulting images are tagged with a tag consisting of node version and the release tag. for example, `16-beta`, `14-beta` etc. 7 | 8 | ## Node images with browser automation libraries 9 | Images with browser automation libraries such as `apify/actor-node-puppeteer-*` and `apify/actor-node-playwright-*` follow the same principle as node image but add the browser automation version tag. The latest version is released with the tag `latest`, based on the newest node. The other tags for node versions consist of node version and browser automation library as well as only node version. For example, 14, 14-1.7.0 or 15-1.7.0. Other than the latest releases, such as beta, the images are tagged with node version, browser automation library version, and the release tag, in this case, beta. The tags look like this 14-1.7.0-beta or 15-1.7.0-beta etc. -------------------------------------------------------------------------------- /node-playwright.md: -------------------------------------------------------------------------------- 1 | # node-playwright-* images 2 | This short readme should walk you through the problem and solution of custom-made playwright images. 3 | 4 | ## The problem 5 | 6 | We maximized our efforts to make the images as small as possible, so we bundled the images with the preinstalled playwright and respective browser. The problem is that each playwright version comes with its bundled browser. For example, `playwright 1.7` comes with `firefox-1234`. This is still alright since we have added the playwright version tag to our images. The real trouble happens if someone wants to create an actor with this image, but they use a different playwright version. The browser won't start because `playwright 1.8` looks for its firefox, which is not `firefox-1234`, but `firefox-2345`. 7 | 8 | ## The solution (One of many) 9 | The solution is quite straightforward: rename all the browser folders to be playwright version agnostic and allow developers to reinstall playwright if the version of the browser and version of playwright are not compatible. To do that, we need to create a new environment variable, `APIFY_DEFAULT_BROWSER_PATH`, and assign the version agnostic browser binary path to it. In Apify SDK, we need to use this path as a `defaultExecutablePath` for the `PlaywrightLauncher` class. 10 | -------------------------------------------------------------------------------- /node-playwright-webkit/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { getMemoryInfo } = require('crawlee'); 16 | const testWebkit = require('./webkit_test'); 17 | 18 | Actor.main(async () => { 19 | // Sanity test browsers. 20 | 21 | // Try to use full Webkit headless 22 | await testWebkit({ headless: true }); 23 | 24 | // Try to use full Webkit with XVFB 25 | await testWebkit({ headless: false }); 26 | 27 | // Try to use playwright default 28 | await testWebkit({ executablePath: undefined }); 29 | await testWebkit({ executablePath: process.env.APIFY_DEFAULT_BROWSER_PATH }); 30 | 31 | // Test that "ps" command is available, sometimes it was missing in official Node builds 32 | await getMemoryInfo(); 33 | }); 34 | -------------------------------------------------------------------------------- /node-playwright-firefox/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { getMemoryInfo } = require('crawlee'); 16 | const testFirefox = require('./firefox_test'); 17 | 18 | Actor.main(async () => { 19 | // Sanity test browsers. 20 | 21 | // Try to use full Firefox headless 22 | await testFirefox({ headless: true }); 23 | 24 | // Try to use full Firefox with XVFB 25 | await testFirefox({ headless: false }); 26 | 27 | // Try to use playwright default 28 | await testFirefox({ executablePath: undefined }); 29 | await testFirefox({ executablePath: process.env.APIFY_DEFAULT_BROWSER_PATH }); 30 | 31 | // Test that "ps" command is available, sometimes it was missing in official Node builds 32 | await getMemoryInfo(); 33 | }); 34 | -------------------------------------------------------------------------------- /node-playwright-camoufox/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { getMemoryInfo } = require('crawlee'); 16 | const testFirefox = require('./firefox_test'); 17 | 18 | Actor.main(async () => { 19 | // Sanity test browsers. 20 | 21 | // Try to use full Firefox headless 22 | await testFirefox({ headless: true }); 23 | 24 | // Try to use full Firefox with XVFB 25 | await testFirefox({ headless: false }); 26 | 27 | // Try to use playwright default 28 | await testFirefox({ executablePath: undefined }); 29 | await testFirefox({ executablePath: process.env.APIFY_DEFAULT_BROWSER_PATH }); 30 | 31 | // Test that "ps" command is available, sometimes it was missing in official Node builds 32 | await getMemoryInfo(); 33 | }); 34 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/check-puppeteer-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.puppeteer; 9 | 10 | if (!dependencyVersion) { 11 | // no puppeteer dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`puppeteer dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*puppeteer.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*puppeteer.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`puppeteer version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /node-playwright/check-playwright-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.playwright; 9 | 10 | if (!dependencyVersion) { 11 | // no playwright dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`playwright dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`playwright version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /node-playwright-camoufox/check-playwright-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.playwright; 9 | 10 | if (!dependencyVersion) { 11 | // no playwright dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`playwright dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`playwright version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /node-playwright-chrome/check-playwright-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.playwright; 9 | 10 | if (!dependencyVersion) { 11 | // no playwright dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`playwright dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`playwright version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /node-playwright-firefox/check-playwright-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.playwright; 9 | 10 | if (!dependencyVersion) { 11 | // no playwright dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`playwright dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`playwright version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /node-playwright-webkit/check-playwright-version.mjs: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'node:fs'; 2 | import { join } from 'node:path'; 3 | 4 | const packageJsonPath = join(import.meta.dirname, 'package.json'); 5 | const dockerfilePath = join(import.meta.dirname, 'Dockerfile'); 6 | 7 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); 8 | const dependencyVersion = packageJson.dependencies?.playwright; 9 | 10 | if (!dependencyVersion) { 11 | // no playwright dependency found in package.json 12 | process.exit(0); 13 | } 14 | 15 | if (dependencyVersion.match(/^[\^~]/)) { 16 | console.error(`playwright dependency in package.json is not pinned to a specific version. Please pin it to a specific version and use the same version in your Dockerfile base image tag, e.g. ${dependencyVersion.replace(/^[\^~]/, '')}.`); 17 | process.exit(1); 18 | } 19 | 20 | const dockerfileContent = readFileSync(dockerfilePath, 'utf8'); 21 | const matches = dockerfileContent.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/ig); 22 | 23 | for (const match of matches) { 24 | const dockerImageVersion = match.match(/FROM\s+.*playwright.*:\d+-(\d+\.\d+\.\d+)/i)?.[1]; 25 | 26 | if (dockerImageVersion !== dependencyVersion) { 27 | console.error(`playwright version in Dockerfile (${dockerImageVersion}) does not match version in package.json (${dependencyVersion})`); 28 | process.exit(1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/scripts/prepare-node-image-tags.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | const { CURRENT_NODE, LATEST_NODE, RELEASE_TAG, IMAGE_NAME, FRAMEWORK_VERSION, IS_LATEST_BROWSER_IMAGE } = process.env 3 | const tags = []; 4 | 5 | if (CURRENT_NODE === LATEST_NODE && IS_LATEST_BROWSER_IMAGE === 'true') { 6 | // apify/actor-node-x:latest 7 | tags.push(`${IMAGE_NAME}:${RELEASE_TAG}`); 8 | } 9 | 10 | // latest version 11 | if (RELEASE_TAG === 'latest') { 12 | if (FRAMEWORK_VERSION) { 13 | // apify/actor-node-x:20-4.2.0 14 | tags.push(`${IMAGE_NAME}:${CURRENT_NODE}-${FRAMEWORK_VERSION}`) 15 | } 16 | 17 | // apify/actor-node-x:20 18 | // we want this only when the browser image is also latest 19 | if (IS_LATEST_BROWSER_IMAGE === 'true') { 20 | tags.push(`${IMAGE_NAME}:${CURRENT_NODE}`); 21 | } 22 | } else { 23 | // beta and other tags 24 | if (FRAMEWORK_VERSION) { 25 | // apify/actor-node-x:20-4.2.0-beta 26 | tags.push(`${IMAGE_NAME}:${CURRENT_NODE}-${FRAMEWORK_VERSION}-${RELEASE_TAG}`); 27 | } 28 | 29 | // apify/actor-node-x:20-beta 30 | // we don't care if the browser image is latest or not, as its a beta image 31 | tags.push(`${IMAGE_NAME}:${CURRENT_NODE}-${RELEASE_TAG}`); 32 | } 33 | 34 | return { allTags: tags.join(','), firstImageName: tags[0] }; 35 | } 36 | -------------------------------------------------------------------------------- /.github/scripts/prepare-python-image-tags.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | const { CURRENT_PYTHON, LATEST_PYTHON, RELEASE_TAG, IMAGE_NAME, FRAMEWORK_VERSION, IS_LATEST_BROWSER_IMAGE } = process.env 3 | const tags = []; 4 | 5 | if (CURRENT_PYTHON === LATEST_PYTHON && IS_LATEST_BROWSER_IMAGE === 'true') { 6 | // apify/actor-python-x:latest 7 | tags.push(`${IMAGE_NAME}:${RELEASE_TAG}`); 8 | } 9 | 10 | // latest version 11 | if (RELEASE_TAG === 'latest') { 12 | if (FRAMEWORK_VERSION) { 13 | // apify/actor-python-x:3.13-4.2.0 14 | tags.push(`${IMAGE_NAME}:${CURRENT_PYTHON}-${FRAMEWORK_VERSION}`) 15 | } 16 | 17 | // apify/actor-python-x:3.13 18 | // we want this only when browser image is also latest 19 | if (IS_LATEST_BROWSER_IMAGE === 'true') { 20 | tags.push(`${IMAGE_NAME}:${CURRENT_PYTHON}`); 21 | } 22 | } else { 23 | // beta and other tags 24 | if (FRAMEWORK_VERSION) { 25 | // apify/actor-python-x:3.13-4.2.0-beta 26 | tags.push(`${IMAGE_NAME}:${CURRENT_PYTHON}-${FRAMEWORK_VERSION}-${RELEASE_TAG}`); 27 | } 28 | 29 | // apify/actor-python-x:3.13-beta 30 | // we don't care if the browser image is latest or not, as its a beta image 31 | tags.push(`${IMAGE_NAME}:${CURRENT_PYTHON}-${RELEASE_TAG}`); 32 | } 33 | 34 | return { allTags: tags.join(','), firstImageName: tags[0] }; 35 | } 36 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/data/cache-states-beta.json: -------------------------------------------------------------------------------- 1 | { 2 | "node:normal": { 3 | "hash": "326d8f05d19439edf63961843990b085817b5fe28c92ebe8327706b661b72485", 4 | "hashEntries": "APIFY_VERSION=3.5.2;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24" 5 | }, 6 | "node:playwright": { 7 | "hash": "e3c1e425b7113c82039659e9cdaa41de7f44f5a551dc741a7e1c52ab2a934b97", 8 | "hashEntries": "APIFY_VERSION=3.5.2;CAMOUFOX_VERSION=0.8.4;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24;PLAYWRIGHT_VERSION=1.55.0,1.55.1,1.56.0,1.56.1,1.57.0" 9 | }, 10 | "node:puppeteer-chrome": { 11 | "hash": "a3d3a5d91be4339c909778f4ae73885c1669b716a2f760c5c96da014abba5261", 12 | "hashEntries": "APIFY_VERSION=3.5.2;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24;PUPPETEER_VERSION=24.30.0,24.31.0,24.32.0,24.32.1,24.33.0" 13 | }, 14 | "python:normal": { 15 | "hash": "1cb2878266be74fa177026f8cfecd2a91e21646df264441ca2ef0571c1837a9e", 16 | "hashEntries": "APIFY_VERSION=2.2.1;PYTHON_VERSION=3.9,3.10,3.11,3.12,3.13" 17 | }, 18 | "python:playwright": { 19 | "hash": "db96247acb01cb5a585e9689433142693336c3b4038215f4b630366736c6df4a", 20 | "hashEntries": "APIFY_VERSION=2.7.2;PLAYWRIGHT_VERSION=1.50.0,1.51.0,1.52.0,1.53.0,1.54.0;PYTHON_VERSION=3.9,3.10,3.11,3.12,3.13" 21 | }, 22 | "python:selenium": { 23 | "hash": "c6474bc43d1960f1d2867c774278e9d38dfdadda7070d42edc3c839043d8df20", 24 | "hashEntries": "APIFY_VERSION=2.2.1;PYTHON_VERSION=3.9,3.10,3.11,3.12,3.13;SELENIUM_VERSION=4.26.1,4.27.0,4.27.1,4.28.0,4.28.1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/data/cache-states-latest.json: -------------------------------------------------------------------------------- 1 | { 2 | "node:normal": { 3 | "hash": "326d8f05d19439edf63961843990b085817b5fe28c92ebe8327706b661b72485", 4 | "hashEntries": "APIFY_VERSION=3.5.2;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24" 5 | }, 6 | "node:playwright": { 7 | "hash": "e3c1e425b7113c82039659e9cdaa41de7f44f5a551dc741a7e1c52ab2a934b97", 8 | "hashEntries": "APIFY_VERSION=3.5.2;CAMOUFOX_VERSION=0.8.4;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24;PLAYWRIGHT_VERSION=1.55.0,1.55.1,1.56.0,1.56.1,1.57.0" 9 | }, 10 | "node:puppeteer-chrome": { 11 | "hash": "f513c1720f42271bb57429e677f2af67fe0b177d5943dd2bd9a64d74222f1ca7", 12 | "hashEntries": "APIFY_VERSION=3.5.2;CRAWLEE_VERSION=3.15.3;NODE_VERSION=20,22,24;PUPPETEER_VERSION=24.31.0,24.32.0,24.32.1,24.33.0,24.33.1" 13 | }, 14 | "python:normal": { 15 | "hash": "548c79a537dea0f7d7bc53b30a8b0a5a3e43c8d8658877a584bb956707d87156", 16 | "hashEntries": "APIFY_VERSION=3.1.0;PYTHON_VERSION=3.10,3.11,3.12,3.13,3.14" 17 | }, 18 | "python:playwright": { 19 | "hash": "ebb9ca7b925ee7efab8390cbdae696bf1a58b3e643169b827e56413a0644c764", 20 | "hashEntries": "APIFY_VERSION=3.1.0;PLAYWRIGHT_VERSION=1.53.0,1.54.0,1.55.0,1.56.0,1.57.0;PYTHON_VERSION=3.10,3.11,3.12,3.13,3.14" 21 | }, 22 | "python:selenium": { 23 | "hash": "ca2322f8844ac0101ad10b5ebe3f21f1ad7295df1c8c78ee180fae58d25de3c3", 24 | "hashEntries": "APIFY_VERSION=3.1.0;PYTHON_VERSION=3.10,3.11,3.12,3.13,3.14;SELENIUM_VERSION=4.35.0,4.36.0,4.37.0,4.38.0,4.39.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/python/normal.ts: -------------------------------------------------------------------------------- 1 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 2 | import { emptyMatrix, latestPythonVersion, supportedPythonVersions } from '../../shared/constants.ts'; 3 | import { fetchPackageVersions } from '../../shared/pypi.ts'; 4 | 5 | const apifyVersions = await fetchPackageVersions('apify'); 6 | 7 | let latestApifyVersion = apifyVersions.at(-1)!; 8 | 9 | console.error('Latest apify version:', latestApifyVersion); 10 | 11 | if (process.env.APIFY_VERSION) { 12 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 13 | latestApifyVersion = process.env.APIFY_VERSION; 14 | } 15 | 16 | const cacheParams: CacheValues = { 17 | PYTHON_VERSION: supportedPythonVersions, 18 | APIFY_VERSION: [latestApifyVersion], 19 | }; 20 | 21 | if (!(await needsToRunMatrixGeneration('python:normal', cacheParams))) { 22 | console.error('Matrix is up to date, skipping new image building'); 23 | 24 | console.log(emptyMatrix); 25 | 26 | process.exit(0); 27 | } 28 | 29 | const matrix = { 30 | include: [] as { 31 | 'image-name': 'python'; 32 | 'python-version': string; 33 | 'apify-version': string; 34 | 'latest-python-version': string; 35 | }[], 36 | }; 37 | 38 | for (const pythonVersion of supportedPythonVersions) { 39 | matrix.include.push({ 40 | 'image-name': 'python', 41 | 'python-version': pythonVersion, 42 | 'apify-version': latestApifyVersion, 43 | 'latest-python-version': latestPythonVersion, 44 | }); 45 | } 46 | 47 | console.log(JSON.stringify(matrix)); 48 | 49 | await updateCacheState('python:normal', cacheParams); 50 | -------------------------------------------------------------------------------- /node-playwright-chrome/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { launchPlaywright, getMemoryInfo } = require('crawlee'); 16 | const { testChrome } = require('./chrome_test'); 17 | 18 | Actor.main(async () => { 19 | // Sanity test browsers. 20 | // We need --no-sandbox, because even though the build is running on GitHub, the test is running in Docker. 21 | const launchOptions = { headless: true, args: ['--no-sandbox'] }; 22 | const launchContext = { launchOptions }; 23 | 24 | const browser = await launchPlaywright(launchContext); 25 | await browser.close(); 26 | 27 | // Try to use full Chrome headless 28 | await testChrome({ headless: true }); 29 | 30 | // Try to use full Chrome with XVFB 31 | await testChrome({ headless: false }); 32 | 33 | // Try to use playwright default 34 | await testChrome({ executablePath: undefined }); 35 | await testChrome({ executablePath: process.env.APIFY_DEFAULT_BROWSER_PATH }); 36 | 37 | // Test that "ps" command is available, sometimes it was missing in official Node builds 38 | await getMemoryInfo(); 39 | }); 40 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { launchPuppeteer, getMemoryInfo } = require('crawlee'); 16 | const testPuppeteerChrome = require('./puppeteer_chrome_test'); 17 | 18 | Actor.main(async () => { 19 | // First, try to open Chromium to see all dependencies are correctly installed 20 | console.log('Testing Puppeteer with Chromium'); 21 | // We need --no-sandbox, because even though the build is running on GitHub, the test is running in Docker. 22 | const launchOptions = { headless: true, args: ['--no-sandbox'] }; 23 | const browser1 = await launchPuppeteer({ launchOptions }); 24 | const page1 = await browser1.newPage(); 25 | await page1.goto('http://www.example.com'); 26 | const pageTitle1 = await page1.title(); 27 | if (pageTitle1 !== 'Example Domain') { 28 | throw new Error(`Puppeteer+Chromium test failed - returned title "${pageTitle1}"" !== "Example Domain"`); 29 | } 30 | await browser1.close(); 31 | 32 | // Second, try to use full Chrome 33 | await testPuppeteerChrome(); 34 | 35 | // Test that "ps" command is available, sometimes it was missing in official Node builds 36 | await getMemoryInfo(); 37 | 38 | console.log('... test PASSED'); 39 | }); 40 | -------------------------------------------------------------------------------- /node/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=22 2 | FROM node:${NODE_VERSION}-alpine 3 | 4 | LABEL maintainer="support@apify.com" description="Base image for simple Apify Actors" 5 | 6 | # Globally disable the update-notifier. 7 | RUN npm config --global set update-notifier false \ 8 | # add user 9 | && addgroup -S myuser \ 10 | && adduser -S -h /home/myuser -s /bin/sh -D myuser -G myuser \ 11 | && adduser myuser audio \ 12 | && adduser myuser video \ 13 | && mkdir -p /home/myuser/Downloads \ 14 | && chown -R myuser:myuser /home/myuser \ 15 | && mkdir -p /usr/src/app \ 16 | && chown -R myuser:myuser /usr/src/app \ 17 | && ln -s /usr/src/app /home/myuser 18 | 19 | WORKDIR /usr/src/app 20 | 21 | # Copy source code 22 | COPY --chown=myuser:myuser package.json main.js . 23 | 24 | # Install default dependencies, print versions of everything 25 | RUN npm --quiet set progress=false \ 26 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 27 | && echo "Installed NPM packages:" \ 28 | && (npm list --omit=dev --omit=optional || true) \ 29 | && echo "Node.js version:" \ 30 | && node --version \ 31 | && echo "NPM version:" \ 32 | && npm --version 33 | 34 | # Tell Node.js this is a production environemnt 35 | ENV NODE_ENV=production 36 | 37 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 38 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 39 | # However they did not think about all the sites there with large headers, 40 | # so we put back the old limit of 80kb, which seems to work just fine. 41 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 42 | 43 | # NOTEs: 44 | # - This needs to be compatible with CLI. 45 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 46 | CMD ["npm", "start", "--silent"] 47 | -------------------------------------------------------------------------------- /node-playwright/main.js: -------------------------------------------------------------------------------- 1 | // This file will be replaced by the content of the Act2.sourceCode field, 2 | // we keep this one here just for testing and clarification. 3 | 4 | console.log( 5 | `If you're seeing this text, it means the actor started the default "main.js" file instead 6 | of your own source code file. You have two options how to fix this: 7 | 1) Rename your source code file to "main.js" 8 | 2) Define custom "package.json" and/or "Dockerfile" that will run your code your way 9 | 10 | For more information, see https://docs.apify.com/actors/development/source-code#custom-dockerfile 11 | `); 12 | console.log('Testing Docker image...'); 13 | 14 | const { Actor } = require('apify'); 15 | const { launchPlaywright, getMemoryInfo } = require('crawlee'); 16 | const playwright = require('playwright'); 17 | const { testChrome, testPageLoading } = require('./chrome_test'); 18 | 19 | Actor.main(async () => { 20 | const browsers = ['webkit', 'firefox', 'chromium']; 21 | const promisesHeadless = browsers.map(async (browserName) => { 22 | console.log(`Testing Playwright with ${browserName} and headless`); 23 | const browser = await launchPlaywright({ launcher: playwright[browserName] }); 24 | return testPageLoading(browser); 25 | }); 26 | 27 | const promisesHeadful = browsers.map(async (browserName) => { 28 | console.log(`Testing Playwright with ${browserName} and headful`); 29 | const browser = await launchPlaywright({ launcher: playwright[browserName], launchOptions: { headless: false } }); 30 | return testPageLoading(browser); 31 | }); 32 | 33 | await Promise.all(promisesHeadless); 34 | await Promise.all(promisesHeadful); 35 | 36 | // Try to use full Chrome headless 37 | await testChrome({ headless: true }); 38 | 39 | // Try to use full Chrome with XVFB 40 | await testChrome({ headless: false, args: ['--disable-gpu'] }); 41 | 42 | // Test that "ps" command is available, sometimes it was missing in official Node builds 43 | await getMemoryInfo(); 44 | 45 | console.log('All tests passed!'); 46 | }); 47 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/node/normal.ts: -------------------------------------------------------------------------------- 1 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 2 | import { emptyMatrix, latestNodeVersion, supportedNodeVersions } from '../../shared/constants.ts'; 3 | import { fetchPackageVersions } from '../../shared/npm.ts'; 4 | 5 | const apifyVersions = await fetchPackageVersions('apify'); 6 | const crawleeVersions = await fetchPackageVersions('crawlee'); 7 | 8 | let latestCrawleeVersion = crawleeVersions.at(-1)!; 9 | let latestApifyVersion = apifyVersions.at(-1)!; 10 | 11 | console.error('Latest crawlee version:', latestCrawleeVersion); 12 | console.error('Latest apify version:', latestApifyVersion); 13 | 14 | if (process.env.CRAWLEE_VERSION) { 15 | console.error('Using custom crawlee version:', process.env.CRAWLEE_VERSION); 16 | latestCrawleeVersion = process.env.CRAWLEE_VERSION; 17 | } 18 | 19 | if (process.env.APIFY_VERSION) { 20 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 21 | latestApifyVersion = process.env.APIFY_VERSION; 22 | } 23 | 24 | const cacheParams: CacheValues = { 25 | NODE_VERSION: supportedNodeVersions, 26 | APIFY_VERSION: [latestApifyVersion], 27 | CRAWLEE_VERSION: [latestCrawleeVersion], 28 | }; 29 | 30 | if (!(await needsToRunMatrixGeneration('node:normal', cacheParams))) { 31 | console.error('Matrix generation is not needed, exiting.'); 32 | 33 | console.log(emptyMatrix); 34 | 35 | process.exit(0); 36 | } 37 | 38 | const matrix = { 39 | include: [] as { 40 | 'image-name': 'node'; 41 | 'node-version': string; 42 | 'apify-version': string; 43 | 'crawlee-version': string; 44 | 'latest-node-version': string; 45 | }[], 46 | }; 47 | 48 | for (const nodeVersion of supportedNodeVersions) { 49 | matrix.include.push({ 50 | 'image-name': 'node', 51 | 'node-version': nodeVersion, 52 | // Node uses semver ranges for the versions 53 | 'apify-version': `^${latestApifyVersion}`, 54 | 'crawlee-version': `^${latestCrawleeVersion}`, 55 | 'latest-node-version': latestNodeVersion, 56 | }); 57 | } 58 | 59 | console.log(JSON.stringify(matrix)); 60 | 61 | await updateCacheState('node:normal', cacheParams); 62 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/shared/pypi.ts: -------------------------------------------------------------------------------- 1 | import { compare } from 'semver'; 2 | 3 | const pypiPackageInfoRoute = (pkg: string) => `https://pypi.org/pypi/${pkg}/json`; 4 | const pypiPackageVersionInfoRoute = (pkg: string, version: string) => `https://pypi.org/pypi/${pkg}/${version}/json`; 5 | 6 | // Only documents what we need 7 | interface PackageInfo { 8 | info: { 9 | requires_dist: string[]; 10 | requires_python: string; 11 | version: string; 12 | yanked: boolean; 13 | }; 14 | releases: Record< 15 | string, 16 | { 17 | python_version: string; 18 | requires_python: string; 19 | yanked: boolean; 20 | }[] 21 | >; 22 | } 23 | 24 | export async function fetchPackageVersions(packageName: string) { 25 | const url = pypiPackageInfoRoute(packageName); 26 | 27 | const response = await fetch(url); 28 | 29 | if (!response.ok) { 30 | throw new Error(`Failed to fetch package info for ${packageName}`, { 31 | cause: await response.text(), 32 | }); 33 | } 34 | 35 | const json: PackageInfo = await response.json(); 36 | 37 | const rawVersions = Object.keys(json.releases); 38 | 39 | // For some reason tagged versions follow a structure like `0.0.0a0` (where `a` is a "tag") 40 | const filtered = rawVersions.filter((version) => !/[a-z]/.test(version)); 41 | 42 | return filtered.sort((a, b) => compare(a, b)); 43 | } 44 | 45 | interface PackageVersionInfo { 46 | info: { 47 | requires_dist: string[]; 48 | requires_python: string; 49 | version: string; 50 | yanked: boolean; 51 | }; 52 | requires_dist: string[]; 53 | requires_python: string; 54 | yanked: boolean; 55 | } 56 | 57 | export async function fetchPackageVersion(packageName: string, version: string) { 58 | const url = pypiPackageVersionInfoRoute(packageName, version); 59 | 60 | const response = await fetch(url); 61 | 62 | if (!response.ok) { 63 | throw new Error(`Failed to fetch package info for ${packageName}, version ${version}`, { 64 | cause: await response.text(), 65 | }); 66 | } 67 | 68 | const json: PackageVersionInfo = await response.json(); 69 | 70 | return json; 71 | } 72 | 73 | export const pythonRequirementRegex = /(?[a-zA-Z0-9\-]+)(?[<>=]+)(?[0-9\.]+)/; 74 | -------------------------------------------------------------------------------- /python/Dockerfile: -------------------------------------------------------------------------------- 1 | # Get the Python version provided as a build argument 2 | ARG PYTHON_VERSION 3 | 4 | # Extend from the latest Debian and its slim version to keep the image as small as possible 5 | FROM python:${PYTHON_VERSION}-slim-trixie 6 | 7 | # Add labels to the image to identify it as an Apify Actor 8 | LABEL maintainer="support@apify.com" \ 9 | description="Base image for simple Apify Actors written in Python" 10 | 11 | # Set the shell to use /bin/bash with specific options (see Hadolint DL4006) 12 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 13 | 14 | # Get the Apify Python SDK version provided as a build argument 15 | ARG APIFY_VERSION 16 | 17 | # Don't store bytecode, the Python app will be only run once 18 | ENV PYTHONDONTWRITEBYTECODE=1 19 | 20 | # Don't buffer output and flush it straight away 21 | ENV PYTHONUNBUFFERED=1 22 | 23 | # Don't use a cache dir 24 | ENV PIP_NO_CACHE_DIR=1 25 | 26 | # Disable warnings about outdated pip 27 | ENV PIP_DISABLE_PIP_VERSION_CHECK=1 28 | 29 | # Disable warnings about running pip as root 30 | ENV PIP_ROOT_USER_ACTION=ignore 31 | 32 | # Setup the less privileged user 33 | RUN apt update && \ 34 | apt install -y --no-install-recommends \ 35 | curl \ 36 | git \ 37 | procps \ 38 | wget \ 39 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 40 | && mkdir -p /home/myuser/Downloads \ 41 | && chown -R myuser:myuser /home/myuser \ 42 | && mkdir -p /usr/src/app \ 43 | && chown -R myuser:myuser /usr/src/app \ 44 | && ln -s /usr/src/app /home/myuser \ 45 | && apt autoremove -yqq --purge \ 46 | && apt clean \ 47 | && rm -rf /var/lib/apt/lists/* /var/log/* 48 | 49 | WORKDIR /usr/src/app 50 | 51 | ENV PATH="/root/.local/bin:/home/myuser/.local/bin:$PATH" 52 | 53 | # This instruction: 54 | # - Upgrades pip to the latest version 55 | # - Preinstalls the latest versions of setuptools and wheel to improve package installation speed 56 | # - Installs the specified version of the Apify Python SDK 57 | RUN pip install --upgrade \ 58 | pip \ 59 | setuptools \ 60 | wheel \ 61 | apify~=${APIFY_VERSION} 62 | 63 | # Copy the dummy source code to the image 64 | COPY --chown=myuser:myuser . . 65 | 66 | # Set default startup command, using CMD instead of ENTRYPOINT, to allow manual overriding 67 | CMD ["python3", "-m", "src"] 68 | -------------------------------------------------------------------------------- /.github/scripts/set-dependency-versions.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | const PACKAGE_JSON_PATH = './package.json'; 4 | 5 | const DEPENDENCY_VERSIONS = { 6 | 'apify': process.env.APIFY_VERSION, 7 | 'crawlee': process.env.CRAWLEE_VERSION, 8 | 'puppeteer': process.env.PUPPETEER_VERSION, 9 | 'playwright': process.env.PLAYWRIGHT_VERSION, 10 | 'playwright-chromium': process.env.PLAYWRIGHT_VERSION, 11 | 'playwright-firefox': process.env.PLAYWRIGHT_VERSION, 12 | 'playwright-webkit': process.env.PLAYWRIGHT_VERSION, 13 | 'camoufox-js': process.env.CAMOUFOX_VERSION, 14 | }; 15 | 16 | const pkg = readPackageJson(PACKAGE_JSON_PATH); 17 | updateDependencyVersions(pkg, DEPENDENCY_VERSIONS); 18 | fs.writeFileSync(PACKAGE_JSON_PATH, JSON.stringify(pkg, null, 4)); 19 | 20 | function readPackageJson(path) { 21 | try { 22 | const pkgJson = fs.readFileSync(path, 'utf-8'); 23 | return JSON.parse(pkgJson); 24 | } catch (err) { 25 | if (err.code === 'ENOENT') { 26 | console.log(`No package.json to update in ${process.cwd()}`); 27 | process.exit(0); 28 | } 29 | } 30 | } 31 | 32 | /** 33 | * Updates versions of dependencies that are listed in the package.json 34 | * @param {object} pkg 35 | * @param {object} dependencyVersions 36 | */ 37 | function updateDependencyVersions(pkg, dependencyVersions) { 38 | Object.entries(dependencyVersions).forEach(([name, version]) => { 39 | return updateDependencyVersion(pkg, name, version); 40 | }); 41 | } 42 | 43 | function updateDependencyVersion(pkg, depName, depVersion) { 44 | if (!pkg.dependencies) throw new Error('Invalid package.json: Has no dependencies.'); 45 | 46 | // Only update existing deps, so we don't add Puppeteer where it does not belong. 47 | if (pkg.dependencies[depName]) { 48 | if (!depVersion) { 49 | throw new Error(`Version not provided for dependency: ${depName}`); 50 | } 51 | 52 | if (!/^[\^~]/.test(depVersion)) { 53 | console.warn(`Dependency ${depName} is set to fixed version ${depVersion}.`); 54 | } 55 | 56 | console.log(`Setting dependency: ${depName} to version: ${depVersion}`); 57 | pkg.dependencies[depName] = depVersion; 58 | } 59 | 60 | if (depName === 'crawlee' && pkg.overrides?.apify) { 61 | Object.keys(pkg.overrides.apify).forEach((dep) => { 62 | console.log(`Setting overrides dependency: ${dep} to version: ${depVersion}`); 63 | pkg.overrides.apify[dep] = depVersion; 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /scripts/update-package-json.mjs: -------------------------------------------------------------------------------- 1 | import { readFile, writeFile } from 'node:fs/promises'; 2 | 3 | if (process.argv.length !== 3) { 4 | console.error(`Usage: node ${process.argv[0]} ./path-to-folder-with-package-json`); 5 | process.exit(1); 6 | } 7 | 8 | const path = process.argv[2]; 9 | 10 | const packageJsonPath = new URL(`../${path}/package.json`, import.meta.url); 11 | 12 | const replacers = ['APIFY_VERSION', 'CRAWLEE_VERSION', 'PLAYWRIGHT_VERSION', 'PUPPETEER_VERSION', 'CAMOUFOX_VERSION']; 13 | 14 | try { 15 | const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8')); 16 | 17 | console.log(`Updating package.json in ${path}`); 18 | 19 | for (const [depName, depVersion] of Object.entries(packageJson.dependencies)) { 20 | if (!replacers.includes(depVersion)) { 21 | continue; 22 | } 23 | 24 | if (!process.env[depVersion]) { 25 | console.error(`Environment variable ${depVersion} is not set, cannot update dependency ${depName}`); 26 | process.exit(1); 27 | } 28 | 29 | packageJson.dependencies[depName] = process.env[depVersion]; 30 | } 31 | 32 | if (packageJson.overrides) { 33 | for (const [depName, depOverrides] of Object.entries(packageJson.overrides)) { 34 | if (typeof depOverrides !== 'object') { 35 | // Maybe string 36 | if (!replacers.includes(depOverrides)) { 37 | continue; 38 | } 39 | 40 | if (!process.env[depOverrides]) { 41 | console.error( 42 | `Environment variable ${depOverrides} is not set, cannot update dependency override for ${depName}`, 43 | ); 44 | process.exit(1); 45 | } 46 | 47 | packageJson.overrides[depName] = process.env[depOverrides]; 48 | 49 | continue; 50 | } 51 | 52 | for (const [depOverrideName, depVersionOverrides] of Object.entries(depOverrides)) { 53 | if (!replacers.includes(depVersionOverrides)) { 54 | continue; 55 | } 56 | 57 | if (!process.env[depVersionOverrides]) { 58 | console.error( 59 | `Environment variable ${depVersionOverrides} is not set, cannot update dependency override for ${depOverrideName}`, 60 | ); 61 | process.exit(1); 62 | } 63 | 64 | packageJson.overrides[depName][depOverrideName] = process.env[depVersionOverrides]; 65 | } 66 | } 67 | } 68 | 69 | await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 4)); 70 | } catch (err) { 71 | console.error(`Failed to read package.json from ${packageJsonPath}`); 72 | console.error(err); 73 | 74 | process.exit(1); 75 | } 76 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/python/selenium.ts: -------------------------------------------------------------------------------- 1 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 2 | import { 3 | emptyMatrix, 4 | latestPythonVersion, 5 | shouldUseLastFive, 6 | supportedPythonVersions, 7 | } from '../../shared/constants.ts'; 8 | import { fetchPackageVersions } from '../../shared/pypi.ts'; 9 | 10 | const versions = await fetchPackageVersions('selenium'); 11 | const apifyVersions = await fetchPackageVersions('apify'); 12 | 13 | if (!shouldUseLastFive) { 14 | console.warn('Testing with only the latest version of selenium to speed up CI'); 15 | } 16 | 17 | const lastFiveSeleniumVersions = versions.slice(shouldUseLastFive ? -5 : -1); 18 | const latestSeleniumVersion = lastFiveSeleniumVersions.at(-1)!; 19 | let latestApifyVersion = apifyVersions.at(-1)!; 20 | 21 | console.error('Last five versions:', lastFiveSeleniumVersions); 22 | console.error('Latest selenium version:', latestSeleniumVersion); 23 | console.error('Latest apify version:', latestApifyVersion); 24 | 25 | if (process.env.APIFY_VERSION) { 26 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 27 | latestApifyVersion = process.env.APIFY_VERSION; 28 | } 29 | 30 | const cacheParams: CacheValues = { 31 | PYTHON_VERSION: supportedPythonVersions, 32 | APIFY_VERSION: [latestApifyVersion], 33 | SELENIUM_VERSION: lastFiveSeleniumVersions, 34 | }; 35 | 36 | if (!(await needsToRunMatrixGeneration('python:selenium', cacheParams))) { 37 | console.error('Matrix generation is not needed, exiting.'); 38 | 39 | console.log(emptyMatrix); 40 | 41 | process.exit(0); 42 | } 43 | 44 | const matrix = { 45 | include: [] as { 46 | 'image-name': 'python-selenium'; 47 | 'python-version': string; 48 | 'selenium-version': string; 49 | 'apify-version': string; 50 | 'is-latest': 'true' | 'false'; 51 | 'latest-python-version': string; 52 | }[], 53 | }; 54 | 55 | for (const pythonVersion of supportedPythonVersions) { 56 | for (const seleniumVersion of lastFiveSeleniumVersions) { 57 | matrix.include.push({ 58 | 'image-name': 'python-selenium', 59 | 'python-version': pythonVersion, 60 | 'selenium-version': seleniumVersion, 61 | 'apify-version': latestApifyVersion, 62 | 'is-latest': seleniumVersion === latestSeleniumVersion ? 'true' : 'false', 63 | 'latest-python-version': latestPythonVersion, 64 | }); 65 | } 66 | } 67 | 68 | console.log(JSON.stringify(matrix)); 69 | 70 | await updateCacheState('python:selenium', cacheParams); 71 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/node/puppeteer.ts: -------------------------------------------------------------------------------- 1 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 2 | import { emptyMatrix, latestNodeVersion, shouldUseLastFive, supportedNodeVersions } from '../../shared/constants.ts'; 3 | import { fetchPackageVersions } from '../../shared/npm.ts'; 4 | 5 | const puppeteerVersions = await fetchPackageVersions('puppeteer'); 6 | const apifyVersions = await fetchPackageVersions('apify'); 7 | const crawleeVersions = await fetchPackageVersions('crawlee'); 8 | 9 | if (!shouldUseLastFive) { 10 | console.warn('Testing with only the latest version of puppeteer to speed up CI'); 11 | } 12 | 13 | const latestFivePuppeteerVersions = puppeteerVersions.slice(shouldUseLastFive ? -5 : -1); 14 | const latestPuppeteerVersion = latestFivePuppeteerVersions.at(-1)!; 15 | let latestApifyVersion = apifyVersions.at(-1)!; 16 | let latestCrawleeVersion = crawleeVersions.at(-1)!; 17 | 18 | console.error('Latest five versions', latestFivePuppeteerVersions); 19 | console.error('Latest apify version', latestApifyVersion); 20 | console.error('Latest crawlee version', latestCrawleeVersion); 21 | 22 | if (process.env.CRAWLEE_VERSION) { 23 | console.error('Using custom crawlee version:', process.env.CRAWLEE_VERSION); 24 | latestCrawleeVersion = process.env.CRAWLEE_VERSION; 25 | } 26 | 27 | if (process.env.APIFY_VERSION) { 28 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 29 | latestApifyVersion = process.env.APIFY_VERSION; 30 | } 31 | 32 | const cacheParams: CacheValues = { 33 | NODE_VERSION: supportedNodeVersions, 34 | PUPPETEER_VERSION: latestFivePuppeteerVersions, 35 | APIFY_VERSION: [latestApifyVersion], 36 | CRAWLEE_VERSION: [latestCrawleeVersion], 37 | }; 38 | 39 | if (!(await needsToRunMatrixGeneration('node:puppeteer-chrome', cacheParams))) { 40 | console.error('Matrix generation is not needed, exiting.'); 41 | 42 | console.log(emptyMatrix); 43 | 44 | process.exit(0); 45 | } 46 | 47 | const matrix = { 48 | include: [] as { 49 | 'image-name': 'node-puppeteer-chrome'; 50 | 'node-version': string; 51 | 'puppeteer-version': string; 52 | 'apify-version': string; 53 | 'crawlee-version': string; 54 | 'is-latest': 'true' | 'false'; 55 | 'latest-node-version': string; 56 | }[], 57 | }; 58 | 59 | for (const nodeVersion of supportedNodeVersions) { 60 | for (const puppeteerVersion of latestFivePuppeteerVersions) { 61 | matrix.include.push({ 62 | 'image-name': 'node-puppeteer-chrome', 63 | 'node-version': nodeVersion, 64 | 'puppeteer-version': puppeteerVersion, 65 | 'apify-version': `^${latestApifyVersion}`, 66 | 'crawlee-version': `^${latestCrawleeVersion}`, 67 | 'is-latest': puppeteerVersion === latestPuppeteerVersion ? 'true' : 'false', 68 | 'latest-node-version': latestNodeVersion, 69 | }); 70 | } 71 | } 72 | 73 | console.log(JSON.stringify(matrix)); 74 | 75 | await updateCacheState('node:puppeteer-chrome', cacheParams); 76 | -------------------------------------------------------------------------------- /node-phantomjs/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=16 2 | FROM node:${NODE_VERSION}-alpine 3 | 4 | # First, download PhantomJS and necessary libraries, these change rarely 5 | RUN DEBIAN_FRONTEND=noninteractive apt update \ 6 | && DEBIAN_FRONTEND=noninteractive apt install -y wget ca-certificates --no-install-recommends \ 7 | && wget --no-verbose -O /usr/bin/phantomjs https://s3.amazonaws.com/apifier-phantomjs-builds/phantomjs-2.1.1s-apifier-ubuntu-16.04-x64 \ 8 | && wget --no-verbose -O /lib/x86_64-linux-gnu/libicudata.so.55.1 https://s3.amazonaws.com/apifier-phantomjs-builds/libicudata.so.55.1 \ 9 | && wget --no-verbose -O /lib/x86_64-linux-gnu/libicui18n.so.55.1 https://s3.amazonaws.com/apifier-phantomjs-builds/libicui18n.so.55.1 \ 10 | && wget --no-verbose -O /lib/x86_64-linux-gnu/libicuuc.so.55.1 https://s3.amazonaws.com/apifier-phantomjs-builds/libicuuc.so.55.1 \ 11 | && wget --no-verbose -O /lib/x86_64-linux-gnu/libssl.so.1.0.0 https://s3.amazonaws.com/apifier-phantomjs-builds/libssl.so.1.0.0 \ 12 | && wget --no-verbose -O /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 https://s3.amazonaws.com/apifier-phantomjs-builds/libcrypto.so.1.0.0 \ 13 | && ln -s /lib/x86_64-linux-gnu/libicudata.so.55.1 /lib/x86_64-linux-gnu/libicudata.so.55 \ 14 | && ln -s /lib/x86_64-linux-gnu/libicui18n.so.55.1 /lib/x86_64-linux-gnu/libicui18n.so.55 \ 15 | && ln -s /lib/x86_64-linux-gnu/libicuuc.so.55.1 /lib/x86_64-linux-gnu/libicuuc.so.55 \ 16 | && chmod a+x /usr/bin/phantomjs \ 17 | && chown root:root /usr/bin/phantomjs 18 | 19 | # Install packages 20 | RUN DEBIAN_FRONTEND=noninteractive apt purge --auto-remove -y wget \ 21 | && DEBIAN_FRONTEND=noninteractive apt install -y libfreetype6 libfontconfig1 procps sqlite3 --no-install-recommends \ 22 | && rm -rf /var/lib/apt/lists/* \ 23 | && rm -rf /src/*.deb 24 | 25 | # Run everything after as non-privileged user to avoid warnings 26 | RUN groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 27 | && mkdir -p /home/myuser/Downloads \ 28 | && chown -R myuser:myuser /home/myuser 29 | USER myuser 30 | WORKDIR /home/myuser 31 | 32 | # Copy source code 33 | COPY --chown=myuser:myuser test.js /home/myuser/ 34 | 35 | # Tell Node.js this is a production environemnt 36 | ENV NODE_ENV=production 37 | 38 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 39 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 40 | # However they did not think about all the sites there with large headers, 41 | # so we put back the old limit of 80kb, which seems to work just fine. 42 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 43 | 44 | # Install default dependencies, print versions of everything 45 | RUN echo "Node.js version:" \ 46 | && node --version \ 47 | && echo "NPM version:" \ 48 | && npm --version \ 49 | && npm config --global set update-notifier false 50 | 51 | # We're using CMD instead of ENTRYPOINT, to allow manual overriding 52 | CMD node test.js 53 | -------------------------------------------------------------------------------- /python-playwright/Dockerfile: -------------------------------------------------------------------------------- 1 | # Get the Python version provided as a build argument 2 | ARG PYTHON_VERSION 3 | 4 | # Extend from the latest Debian and its slim version to keep the image as small as possible 5 | FROM python:${PYTHON_VERSION}-slim-trixie 6 | 7 | # Add labels to the image to identify it as an Apify Actor 8 | LABEL maintainer="support@apify.com" \ 9 | description="Base image for Apify Actors written in Python using Playwright" 10 | 11 | # Set the shell to use /bin/bash with specific options (see Hadolint DL4006) 12 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 13 | 14 | # Get the Apify Python SDK version provided as a build argument 15 | ARG APIFY_VERSION 16 | 17 | # Get the Playwright version provided as a build argument 18 | ARG PLAYWRIGHT_VERSION 19 | 20 | # Don't store bytecode, the Python app will be only run once 21 | ENV PYTHONDONTWRITEBYTECODE=1 22 | 23 | # Don't buffer output and flush it straight away 24 | ENV PYTHONUNBUFFERED=1 25 | 26 | # Don't use a cache dir 27 | ENV PIP_NO_CACHE_DIR=1 28 | 29 | # Disable warnings about outdated pip 30 | ENV PIP_DISABLE_PIP_VERSION_CHECK=1 31 | 32 | # Disable warnings about running pip as root 33 | ENV PIP_ROOT_USER_ACTION=ignore 34 | 35 | # Set up XVFB 36 | ENV XVFB_WHD=1920x1080x24+32 37 | 38 | ENV PLAYWRIGHT_BROWSERS_PATH=/pw-browsers 39 | 40 | # Install xvfb and xauth 41 | RUN apt update \ 42 | && apt install -y xvfb xauth git procps curl wget --no-install-recommends \ 43 | # Install playwright browser dependencies 44 | && python3 -m pip install --user playwright~=${PLAYWRIGHT_VERSION} \ 45 | && python3 -m playwright install-deps \ 46 | # Install browsers in a specific path 47 | && python3 -m playwright install \ 48 | && python3 -m pip uninstall -y playwright \ 49 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \ 50 | # Add user so we don't need --no-sandbox. 51 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 52 | && mkdir -p /home/myuser/Downloads \ 53 | && chown -R myuser:myuser /home/myuser \ 54 | && mkdir -p /usr/src/app \ 55 | && chown -R myuser:myuser /usr/src/app \ 56 | && ln -s /usr/src/app /home/myuser \ 57 | # Clean up 58 | && apt autoremove -yqq --purge \ 59 | && apt clean \ 60 | && rm -rf /var/lib/apt/lists/* /var/log/* 61 | 62 | WORKDIR /usr/src/app 63 | 64 | ENV PATH="/root/.local/bin:/home/myuser/.local/bin:$PATH" 65 | 66 | # This instruction: 67 | # - Upgrades pip to the latest version 68 | # - Preinstalls the latest versions of setuptools and wheel to improve package installation speed 69 | # - Installs the specified version of the Apify Python SDK and Playwright 70 | RUN pip install --upgrade \ 71 | pip \ 72 | setuptools \ 73 | wheel \ 74 | apify~=${APIFY_VERSION} \ 75 | playwright~=${PLAYWRIGHT_VERSION} 76 | 77 | # Copy the dummy source code to the image 78 | COPY --chown=myuser:myuser . . 79 | 80 | # NOTE: This needs to be compatible with how Apify CLI launches Actors 81 | ENTRYPOINT ["./xvfb-entrypoint.sh"] 82 | CMD ["python3", "-m", "src"] 83 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/.gitignore: -------------------------------------------------------------------------------- 1 | # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore 2 | 3 | # Logs 4 | 5 | logs 6 | _.log 7 | npm-debug.log_ 8 | yarn-debug.log* 9 | yarn-error.log* 10 | lerna-debug.log* 11 | .pnpm-debug.log* 12 | 13 | # Caches 14 | 15 | .cache 16 | 17 | # Diagnostic reports (https://nodejs.org/api/report.html) 18 | 19 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 20 | 21 | # Runtime data 22 | 23 | pids 24 | _.pid 25 | _.seed 26 | *.pid.lock 27 | 28 | # Directory for instrumented libs generated by jscoverage/JSCover 29 | 30 | lib-cov 31 | 32 | # Coverage directory used by tools like istanbul 33 | 34 | coverage 35 | *.lcov 36 | 37 | # nyc test coverage 38 | 39 | .nyc_output 40 | 41 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 42 | 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | 47 | bower_components 48 | 49 | # node-waf configuration 50 | 51 | .lock-wscript 52 | 53 | # Compiled binary addons (https://nodejs.org/api/addons.html) 54 | 55 | build/Release 56 | 57 | # Dependency directories 58 | 59 | node_modules/ 60 | jspm_packages/ 61 | 62 | # Snowpack dependency directory (https://snowpack.dev/) 63 | 64 | web_modules/ 65 | 66 | # TypeScript cache 67 | 68 | *.tsbuildinfo 69 | 70 | # Optional npm cache directory 71 | 72 | .npm 73 | 74 | # Optional eslint cache 75 | 76 | .eslintcache 77 | 78 | # Optional stylelint cache 79 | 80 | .stylelintcache 81 | 82 | # Microbundle cache 83 | 84 | .rpt2_cache/ 85 | .rts2_cache_cjs/ 86 | .rts2_cache_es/ 87 | .rts2_cache_umd/ 88 | 89 | # Optional REPL history 90 | 91 | .node_repl_history 92 | 93 | # Output of 'npm pack' 94 | 95 | *.tgz 96 | 97 | # Yarn Integrity file 98 | 99 | .yarn-integrity 100 | 101 | # dotenv environment variable files 102 | 103 | .env 104 | .env.development.local 105 | .env.test.local 106 | .env.production.local 107 | .env.local 108 | 109 | # parcel-bundler cache (https://parceljs.org/) 110 | 111 | .parcel-cache 112 | 113 | # Next.js build output 114 | 115 | .next 116 | out 117 | 118 | # Nuxt.js build / generate output 119 | 120 | .nuxt 121 | dist 122 | 123 | # Gatsby files 124 | 125 | # Comment in the public line in if your project uses Gatsby and not Next.js 126 | 127 | # https://nextjs.org/blog/next-9-1#public-directory-support 128 | 129 | # public 130 | 131 | # vuepress build output 132 | 133 | .vuepress/dist 134 | 135 | # vuepress v2.x temp and cache directory 136 | 137 | .temp 138 | 139 | # Docusaurus cache and generated files 140 | 141 | .docusaurus 142 | 143 | # Serverless directories 144 | 145 | .serverless/ 146 | 147 | # FuseBox cache 148 | 149 | .fusebox/ 150 | 151 | # DynamoDB Local files 152 | 153 | .dynamodb/ 154 | 155 | # TernJS port file 156 | 157 | .tern-port 158 | 159 | # Stores VSCode versions used for testing VSCode extensions 160 | 161 | .vscode-test 162 | 163 | # yarn v2 164 | 165 | .yarn/cache 166 | .yarn/unplugged 167 | .yarn/build-state.yml 168 | .yarn/install-state.gz 169 | .pnp.* 170 | 171 | # IntelliJ based IDEs 172 | .idea 173 | 174 | # Finder (MacOS) folder config 175 | .DS_Store 176 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apify base Docker images 2 | 3 | Public Docker images for Apify Actor serverless platform (https://docs.apify.com/actor) 4 | 5 | The sources for the images are present in subdirectories that are named as the corresponding 6 | Docker image. For example, the `node` directory corresponds to the 7 | [apify/actor-node](https://hub.docker.com/r/apify/actor-node/) Docker image. 8 | 9 | The images are using the following tags: 10 | 11 | | Tag | Description | 12 | | -------- | -------------------------------------------- | 13 | | `latest` | Well-tested production version of the image. | 14 | | `beta` | Development version of the image. | 15 | 16 | ## Maintenance 17 | 18 | The process of building and publishing new images is automated using GitHub Actions, and a set of scripts that are stored in `.github/actions/version-matrix`. We recommend reading the [`README.md`](.github/actions/version-matrix/README.md) in that directory to understand how the scripts work. 19 | 20 | Manual releases can also be done by triggering the specified workflows manually. At minimum, you **must** specify the `release_tag` input, which is the tag for the image. Every other variable is optional, and if not specified, the matrix generator will fetch the latest version of the corresponding package from the registry. 21 | 22 | > [!CAUTION] 23 | > When manually building a `latest` image, please try to avoid specifying certain library versions unless absolutely necessary. 24 | 25 | ### Adding a new actor image 26 | 27 | To create a new image, which is not yet published in Apify DockerHub organization. 28 | You need access to the organization and rights to create a new repository. 29 | After, you need to follow these steps: 30 | 31 | 1. Create a new folder with the same name as the package you want to create without the prefix `actor-`. 32 | For image `apify/actor-node`, create folder `node`. 33 | 34 | 2. Create a source of the image in that folder. Remember to create a test that is runnable using `docker run` to be able to test in the image in CI/CD. 35 | 36 | 3. Create a new repository in the Apify DockerHub organization, use the name with `actor-` prefix, e.g. `apify/actor-node`. 37 | 38 | 4. Give permission Read & Write to create image for devs groups in the Apify DockerHub organization. 39 | 40 | 5. Create a GitHub workflow which builds, tests and publishes the image into the DockerHub. 41 | 42 | ### Testing images locally 43 | 44 | You will need the following tools installed: docker, make, jq, git 45 | 46 | 1. Clone this repository 47 | 48 | 1. Run `make all` to test out all images (this will take a long while, be patient). You can use `make test-node` or `make test-python` to run a specific collection of tests. 49 | 50 | You can overwrite the node version you build the images for by specifying `NODE_VERSION=xx` environment variable. 51 | You can overwrite the playwright version you build the images for by specifying `PLAYWRIGHT_VERSION=vx.x.x-` environment variable. You must respect the format of `v-` 52 | You can overwrite the puppeteer version you build the images for by specifying `PUPPETEER_VERSION=x.x.x` environment variable. You must respect the format of `` 53 | 54 | 1. If you want to run a specific test, call it with `make `. Run `make what-tests` to see what tests are available. 55 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/python/playwright.ts: -------------------------------------------------------------------------------- 1 | import { fetchPackageVersions } from '../../shared/pypi.ts'; 2 | import { 3 | emptyMatrix, 4 | latestPythonVersion, 5 | shouldUseLastFive, 6 | supportedPythonVersions, 7 | } from '../../shared/constants.ts'; 8 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 9 | import { satisfies } from 'semver'; 10 | 11 | /** 12 | * Certain playwright versions will not run on newer Python versions. 13 | * For example, playwright <1.48.0 will not run on python 3.13+ 14 | * The key represents the python version range where this starts taking effect. 15 | * The value is the playwright version range that is required for the python version. 16 | */ 17 | const playwrightPythonVersionConstraints = [ 18 | // Python, playwright 19 | ['>=3.13.x', '>=1.48.0'], 20 | ]; 21 | 22 | const versions = await fetchPackageVersions('playwright'); 23 | const apifyVersions = await fetchPackageVersions('apify'); 24 | 25 | if (!shouldUseLastFive) { 26 | console.warn('Testing with only the latest version of playwright to speed up CI'); 27 | } 28 | 29 | const lastFivePlaywrightVersions = versions.slice(shouldUseLastFive ? -5 : -1); 30 | const latestPlaywrightVersion = lastFivePlaywrightVersions.at(-1)!; 31 | let latestApifyVersion = apifyVersions.at(-1)!; 32 | 33 | console.error('Last five versions:', lastFivePlaywrightVersions); 34 | console.error('Latest playwright version:', latestPlaywrightVersion); 35 | console.error('Latest apify version:', latestApifyVersion); 36 | 37 | if (process.env.APIFY_VERSION) { 38 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 39 | latestApifyVersion = process.env.APIFY_VERSION; 40 | } 41 | 42 | const cacheParams: CacheValues = { 43 | PYTHON_VERSION: supportedPythonVersions, 44 | APIFY_VERSION: [latestApifyVersion], 45 | PLAYWRIGHT_VERSION: lastFivePlaywrightVersions, 46 | }; 47 | 48 | if (!(await needsToRunMatrixGeneration('python:playwright', cacheParams))) { 49 | console.error('Matrix is up to date, skipping new image building'); 50 | 51 | console.log(emptyMatrix); 52 | 53 | process.exit(0); 54 | } 55 | 56 | const matrix = { 57 | include: [] as { 58 | 'image-name': 'python-playwright'; 59 | 'python-version': string; 60 | 'playwright-version': string; 61 | 'apify-version': string; 62 | 'is-latest': 'true' | 'false'; 63 | 'latest-python-version': string; 64 | }[], 65 | }; 66 | 67 | for (const pythonVersion of supportedPythonVersions) { 68 | const maybePlaywrightVersionConstraint = playwrightPythonVersionConstraints.findLast(([constraint]) => { 69 | return satisfies(`${pythonVersion}.0`, constraint); 70 | })?.[1]; 71 | 72 | for (const playwrightVersion of lastFivePlaywrightVersions) { 73 | if (maybePlaywrightVersionConstraint) { 74 | if (!satisfies(playwrightVersion, maybePlaywrightVersionConstraint)) { 75 | continue; 76 | } 77 | } 78 | 79 | matrix.include.push({ 80 | 'image-name': 'python-playwright', 81 | 'python-version': pythonVersion, 82 | 'playwright-version': playwrightVersion, 83 | 'apify-version': latestApifyVersion, 84 | 'is-latest': playwrightVersion === latestPlaywrightVersion ? 'true' : 'false', 85 | 'latest-python-version': latestPythonVersion, 86 | }); 87 | } 88 | } 89 | 90 | console.log(JSON.stringify(matrix)); 91 | 92 | await updateCacheState('python:playwright', cacheParams); 93 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/matrices/node/playwright.ts: -------------------------------------------------------------------------------- 1 | import { needsToRunMatrixGeneration, updateCacheState, type CacheValues } from '../../shared/cache.ts'; 2 | import { emptyMatrix, latestNodeVersion, shouldUseLastFive, supportedNodeVersions } from '../../shared/constants.ts'; 3 | import { fetchPackageVersions } from '../../shared/npm.ts'; 4 | 5 | const playwrightVersions = await fetchPackageVersions('playwright'); 6 | const apifyVersions = await fetchPackageVersions('apify'); 7 | const crawleeVersions = await fetchPackageVersions('crawlee'); 8 | const camoufoxVersions = await fetchPackageVersions('camoufox-js'); 9 | 10 | if (!shouldUseLastFive) { 11 | console.warn('Testing with only the latest version of playwright to speed up CI'); 12 | } 13 | 14 | const latestFivePlaywrightVersions = playwrightVersions.slice(shouldUseLastFive ? -5 : -1); 15 | const latestPlaywrightVersion = latestFivePlaywrightVersions.at(-1)!; 16 | let latestApifyVersion = apifyVersions.at(-1)!; 17 | let latestCrawleeVersion = crawleeVersions.at(-1)!; 18 | let latestCamoufoxVersion = camoufoxVersions.at(-1)!; 19 | 20 | console.error('Latest five versions', latestFivePlaywrightVersions); 21 | console.error('Latest apify version', latestApifyVersion); 22 | console.error('Latest crawlee version', latestCrawleeVersion); 23 | console.error('Latest camoufox version', latestCamoufoxVersion); 24 | 25 | if (process.env.CRAWLEE_VERSION) { 26 | console.error('Using custom crawlee version:', process.env.CRAWLEE_VERSION); 27 | latestCrawleeVersion = process.env.CRAWLEE_VERSION; 28 | } 29 | 30 | if (process.env.APIFY_VERSION) { 31 | console.error('Using custom apify version:', process.env.APIFY_VERSION); 32 | latestApifyVersion = process.env.APIFY_VERSION; 33 | } 34 | 35 | const cacheParams: CacheValues = { 36 | NODE_VERSION: supportedNodeVersions, 37 | PLAYWRIGHT_VERSION: latestFivePlaywrightVersions, 38 | APIFY_VERSION: [latestApifyVersion], 39 | CRAWLEE_VERSION: [latestCrawleeVersion], 40 | CAMOUFOX_VERSION: [latestCamoufoxVersion], 41 | }; 42 | 43 | if (!(await needsToRunMatrixGeneration('node:playwright', cacheParams))) { 44 | console.error('Matrix generation is not needed, exiting.'); 45 | 46 | console.log(emptyMatrix); 47 | 48 | process.exit(0); 49 | } 50 | 51 | const imageNames = [ 52 | 'node-playwright', 53 | 'node-playwright-chrome', 54 | 'node-playwright-firefox', 55 | 'node-playwright-webkit', 56 | 'node-playwright-camoufox', 57 | ] as const; 58 | 59 | const matrix = { 60 | include: [] as { 61 | 'image-name': (typeof imageNames)[number]; 62 | 'node-version': string; 63 | 'playwright-version': string; 64 | 'apify-version': string; 65 | 'crawlee-version': string; 66 | 'camoufox-version': string; 67 | 'is-latest': 'true' | 'false'; 68 | 'latest-node-version': string; 69 | }[], 70 | }; 71 | 72 | for (const nodeVersion of supportedNodeVersions) { 73 | for (const playwrightVersion of latestFivePlaywrightVersions) { 74 | for (const imageName of imageNames) { 75 | if (imageName.includes('camoufox') && nodeVersion === '18') { 76 | continue; 77 | } 78 | 79 | matrix.include.push({ 80 | 'image-name': imageName, 81 | 'node-version': nodeVersion, 82 | 'playwright-version': playwrightVersion, 83 | 'apify-version': `^${latestApifyVersion}`, 84 | 'crawlee-version': `^${latestCrawleeVersion}`, 85 | 'camoufox-version': `^${latestCamoufoxVersion}`, 86 | 'is-latest': playwrightVersion === latestPlaywrightVersion ? 'true' : 'false', 87 | 'latest-node-version': latestNodeVersion, 88 | }); 89 | } 90 | } 91 | } 92 | 93 | console.log(JSON.stringify(matrix)); 94 | 95 | await updateCacheState('node:playwright', cacheParams); 96 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/src/shared/cache.ts: -------------------------------------------------------------------------------- 1 | import { readFile, writeFile } from 'node:fs/promises'; 2 | 3 | export const PYTHON_VERSION_MARKER = 'PYTHON_VERSION'; 4 | export const NODE_VERSION_MARKER = 'NODE_VERSION'; 5 | export const APIFY_VERSION_MARKER = 'APIFY_VERSION'; 6 | export const PUPPETEER_VERSION_MARKER = 'PUPPETEER_VERSION'; 7 | export const SELENIUM_VERSION_MARKER = 'SELENIUM_VERSION'; 8 | export const PLAYWRIGHT_VERSION_MARKER = 'PLAYWRIGHT_VERSION'; 9 | export const CRAWLEE_VERSION_MARKER = 'CRAWLEE_VERSION'; 10 | export const CAMOUFOX_VERSION_MARKER = 'CAMOUFOX_VERSION'; 11 | 12 | const cacheStateFile = new URL(`../../data/cache-states-${process.env.RELEASE_TAG || 'latest'}.json`, import.meta.url); 13 | 14 | type CacheState = Record; 15 | 16 | export async function getCacheState(): Promise { 17 | try { 18 | const cacheState = JSON.parse(await readFile(cacheStateFile, 'utf8')); 19 | 20 | return cacheState; 21 | } catch (err) { 22 | console.error('Failed to read cache state file', err); 23 | return {}; 24 | } 25 | } 26 | 27 | export type CacheValues = Partial< 28 | Record< 29 | | typeof PYTHON_VERSION_MARKER 30 | | typeof NODE_VERSION_MARKER 31 | | typeof APIFY_VERSION_MARKER 32 | | typeof PUPPETEER_VERSION_MARKER 33 | | typeof SELENIUM_VERSION_MARKER 34 | | typeof PLAYWRIGHT_VERSION_MARKER 35 | | typeof CRAWLEE_VERSION_MARKER 36 | | typeof CAMOUFOX_VERSION_MARKER, 37 | string[] 38 | > 39 | >; 40 | 41 | export async function needsToRunMatrixGeneration(name: string, values: CacheValues) { 42 | // For pull requests, we always want to run the matrix generation. 43 | if (process.env.SKIP_CACHE_CHECK === 'true') { 44 | return true; 45 | } 46 | 47 | const cacheState = await getCacheState(); 48 | 49 | // Never cached -> run matrix generation 50 | 51 | if (!cacheState[name]) { 52 | return true; 53 | } 54 | 55 | const [, hash] = await generateCacheHashForMatrix(name, values); 56 | 57 | // Some of the parameters for the cache changed -> run matrix generation 58 | 59 | if (hash !== cacheState[name].hash) { 60 | return true; 61 | } 62 | 63 | // All parameters are the same -> don't run matrix generation 64 | 65 | return false; 66 | } 67 | 68 | export async function generateCacheHashForMatrix(name: string, values: CacheValues) { 69 | let hashEntriesString = ''; 70 | 71 | // Sort the key, so object order does not affect the cache 72 | const keys = Object.keys(values).sort((a, b) => a.localeCompare(b)) as (keyof CacheValues)[]; 73 | 74 | for (const [i, key] of keys.entries()) { 75 | if (values[key]!.length === 0) { 76 | continue; 77 | } 78 | 79 | hashEntriesString += `${key}=${values[key]!.join(',')}`; 80 | 81 | if (i < keys.length - 1) { 82 | hashEntriesString += ';'; 83 | } 84 | } 85 | 86 | const hash = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(name + hashEntriesString)); 87 | 88 | return [hashEntriesString, Buffer.from(hash).toString('hex')] as const; 89 | } 90 | 91 | export async function updateCacheState(name: string, values: CacheValues) { 92 | // Skip updating the cache if the SKIP_CACHE_CHECK environment variable is set to true 93 | if (process.env.SKIP_CACHE_CHECK === 'true') { 94 | return true; 95 | } 96 | 97 | const cacheState = await getCacheState(); 98 | 99 | const [hashEntries, hash] = await generateCacheHashForMatrix(name, values); 100 | 101 | cacheState[name] = { 102 | hash, 103 | hashEntries, 104 | }; 105 | 106 | await writeFile(cacheStateFile, JSON.stringify(cacheState, null, '\t') + '\n'); 107 | } 108 | -------------------------------------------------------------------------------- /.github/actions/version-matrix/README.md: -------------------------------------------------------------------------------- 1 | # Version Matrix Actions Script 2 | 3 | This folder contains scripts that are used to create Actions matrices for building specific Docker images with the right version combinations of Apify SDK, Playwright/Puppeteer, and Crawlee. 4 | 5 | These scripts are ran using the [bun](https://bun.sh) runtime (for no reason other than ease of use). 6 | 7 | ## Adding a new Node version to the matrix 8 | 9 | When a new version of Node is released, just update the `supportedNodeVersions` array in the `src/shares/constants.ts` file. 10 | 11 | Then, run `SKIP_CACHE_SET=true bun node:normal` locally to preview the new matrix. (you can append `| jq -r '.include[] | "node-version=\(.["node-version"]) apify-version=\(.["apify-version"]) is-latest=\(.["is-latest"])"'` to get a nicer output from the big JSON blob) 12 | 13 | ## Adding a new Python version to the matrix 14 | 15 | When a new version of Python is released, just update the `supportedPythonVersions` array in the `src/shares/constants.ts` file. 16 | 17 | Then, run `SKIP_CACHE_SET=true bun python:normal` locally to preview the new matrix. (you can append `| jq -r '.include[] | "python-version=\(.["python-version"]) playwright-version=\(.["playwright-version"]) apify-version=\(.["apify-version"]) is-latest=\(.["is-latest"])"'` to get a nicer output from the big JSON blob) 18 | 19 | ## Adding a new Python version range for specific Playwright version ranges 20 | 21 | Sometimes, newer Python is not compatible with Playwright versions that were released before a specific one (at the time of writing, this is the case for Playwright 1.48.0 and Python 3.13 -> Python 3.13.x can only run Playwright 1.48.0 and newer). 22 | 23 | To add a new Python version range for a specific Playwright version, add a new entry to the `playwrightPythonVersionConstraints` array in the `python.ts` file. 24 | 25 | The key represents the Python version range where this starts taking effect. The value is the Playwright version range that is required for the Python version. 26 | 27 | ## Updating the runtime version that will be used for images that are referenced with just the build tag 28 | 29 | When we build images, we also include a specific runtime version in the tag (as an example, we have `apify/actor-node:20`). We also provide images tagged with `latest` or `beta`. These images will default to the "latest" runtime version that is specified in the `src/shares/constants.ts` file under `latestPythonVersion` or `latestNodeVersion`. 30 | 31 | When the time comes to bump these, just make a PR, edit those values, and merge it. Next time images get built, the `latest` or `beta` tags will use those new versions for the tag. 32 | 33 | ## Creating new matrices 34 | 35 | The structure for a GitHub Actions matrix is as follows: 36 | 37 | ```ts 38 | interface Matrix { 39 | include: MatrixEntry[]; 40 | } 41 | 42 | type MatrixEntry = Record; 43 | ``` 44 | 45 | When trying to integrate a new matrix into a flow, you need to follow the following steps: 46 | 47 | - have a step that outputs the matrix as a JSON blob 48 | 49 | ```yaml 50 | matrix: 51 | outputs: 52 | matrix: ${{ steps.set-matrix.outputs.matrix }} 53 | 54 | steps: 55 | - name: Generate matrix 56 | id: set-matrix 57 | run: echo "matrix=$(bun python:normal)" >> $GITHUB_OUTPUT 58 | working-directory: ./.github/actions/version-matrix 59 | ``` 60 | 61 | (optionally you can also add in a print step to ensure the matrix is correct. Feel free to copy it from any that uses previous matrices) 62 | 63 | - ensure the actual build step needs the matrix and uses it like this (the if check if optional if the matrix will always have at least one entry): 64 | 65 | ```yaml 66 | needs: [matrix] 67 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 68 | strategy: 69 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 70 | ``` 71 | 72 | - reference matrix values based on the keys in the objects in the `include` array. For example, to get the Python version, you can use `${{ matrix.python-version }}`. 73 | -------------------------------------------------------------------------------- /node-playwright-webkit/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM --platform=linux/amd64 ubuntu:jammy 2 | ARG NODE_VERSION=20 3 | 4 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using Webkit" 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | 7 | # Install WebKit dependencies 8 | RUN apt update \ 9 | && apt install -y --no-install-recommends \ 10 | git \ 11 | procps \ 12 | xvfb \ 13 | xauth \ 14 | # Install node 15 | && apt update && apt install -y curl \ 16 | && curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ 17 | && apt install -y nodejs \ 18 | # Feature-parity with Node.js base images. 19 | # From: https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.focal 20 | && apt update && apt install -y --no-install-recommends git ssh \ 21 | && npm install -g yarn \ 22 | \ 23 | # Add user so we don't need --no-sandbox. 24 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 25 | && mkdir -p /home/myuser/Downloads \ 26 | && chown -R myuser:myuser /home/myuser \ 27 | # Globally disable the update-notifier. 28 | && npm config --global set update-notifier false \ 29 | \ 30 | # Install all required playwright dependencies for webkit 31 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm_config_ignore_scripts=1 npx playwright install-deps webkit \ 32 | && apt install -y libgtk-3-0 \ 33 | \ 34 | # Cleanup time 35 | && rm -rf /var/lib/apt/lists/* \ 36 | && rm -rf /src/*.deb \ 37 | && apt clean -y && apt autoremove -y \ 38 | && rm -rf /root/.npm \ 39 | \ 40 | # This is needed to remove an annoying error message when running headful. 41 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 42 | 43 | # Run everything after as non-privileged user. 44 | USER myuser 45 | WORKDIR /home/myuser 46 | 47 | ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers 48 | 49 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 50 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 51 | 52 | # Copy source code and xvfb script 53 | COPY --chown=myuser:myuser package.json main.js check-playwright-version.mjs webkit_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 54 | 55 | # Tell Node.js this is a production environemnt 56 | ENV NODE_ENV=production 57 | 58 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 59 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 60 | # However they did not think about all the sites there with large headers, 61 | # so we put back the old limit of 80kb, which seems to work just fine. 62 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 63 | 64 | # Install default dependencies, print versions of everything 65 | RUN npm --quiet set progress=false \ 66 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 67 | && echo "Installed NPM packages:" \ 68 | && (npm list --omit=dev --omit=optional || true) \ 69 | && echo "Node.js version:" \ 70 | && node --version \ 71 | && echo "NPM version:" \ 72 | && npm --version \ 73 | # symlink the webkit binary to the root folder in order to bypass the versioning and resulting browser launch crashes. 74 | && ln -s ${PLAYWRIGHT_BROWSERS_PATH}/webkit-*/minibrowser-gtk/MiniBrowser ${PLAYWRIGHT_BROWSERS_PATH}/ \ 75 | # Playwright allows donwloading only one browser through separate package with same export. So we rename it to just playwright. 76 | && mv ./node_modules/playwright-webkit ./node_modules/playwright && rm -rf ./node_modules/playwright-webkit 77 | 78 | ENV APIFY_DEFAULT_BROWSER_PATH=${PLAYWRIGHT_BROWSERS_PATH}/MiniBrowser 79 | 80 | # Prevent installing of browsers by future `npm install`. 81 | ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 82 | 83 | # Set up xvfb 84 | ENV XVFB_WHD=1920x1080x24+32 85 | 86 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 87 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 88 | 89 | # NOTEs: 90 | # - This needs to be compatible with CLI. 91 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 92 | CMD ["npm", "start", "--silent"] 93 | -------------------------------------------------------------------------------- /node-playwright-camoufox/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=20 2 | # Use bookworm to be consistent across node versions. 3 | FROM --platform=linux/amd64 node:${NODE_VERSION}-bookworm-slim 4 | 5 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using Camoufox" 6 | ENV DEBIAN_FRONTEND=noninteractive 7 | 8 | COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh 9 | 10 | # Install Firefox dependencies + tools 11 | RUN sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list' \ 12 | && apt update \ 13 | && apt install -y --no-install-recommends \ 14 | # Found this in other images, not sure whether it's needed, it does not come from Playwright deps 15 | procps \ 16 | # The following packages are needed for the intermediate certificates to work in Firefox. 17 | ca-certificates \ 18 | jq \ 19 | wget \ 20 | p11-kit \ 21 | xauth \ 22 | \ 23 | # Register cerificates 24 | && chmod +x ./register_intermediate_certs.sh \ 25 | && ./register_intermediate_certs.sh \ 26 | \ 27 | # Add user so we don't need --no-sandbox. 28 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 29 | && mkdir -p /home/myuser/Downloads \ 30 | && chown -R myuser:myuser /home/myuser \ 31 | \ 32 | # Globally disable the update-notifier. 33 | && npm config --global set update-notifier false \ 34 | \ 35 | # Install all required playwright dependencies for firefox 36 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm_config_ignore_scripts=1 npx playwright install-deps firefox \ 37 | \ 38 | # Cleanup time 39 | && rm -rf /var/lib/apt/lists/* \ 40 | && rm -rf /src/*.deb \ 41 | && apt clean -y && apt autoremove -y \ 42 | && rm -rf /root/.npm \ 43 | # This is needed to remove an annoying error message when running headful. 44 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 45 | 46 | # Run everything after as non-privileged user. 47 | USER myuser 48 | WORKDIR /home/myuser 49 | 50 | ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers 51 | 52 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 53 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 54 | 55 | # Copy source code and xvfb script 56 | COPY --chown=myuser:myuser package.json main.js check-playwright-version.mjs firefox_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 57 | 58 | # Tell Node.js this is a production environemnt 59 | ENV NODE_ENV=production 60 | 61 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 62 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 63 | # However they did not think about all the sites there with large headers, 64 | # so we put back the old limit of 80kb, which seems to work just fine. 65 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 66 | 67 | # Install default dependencies, print versions of everything 68 | RUN npm --quiet set progress=false \ 69 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 70 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install --no-package-lock --prefer-online --no-save impit@latest \ 71 | && echo "Installed NPM packages:" \ 72 | && (npm list --omit=dev --omit=optional || true) \ 73 | && echo "Node.js version:" \ 74 | && node --version \ 75 | && echo "NPM version:" \ 76 | && npm --version \ 77 | # Install Camoufox 78 | && npx camoufox-js fetch \ 79 | # Overrides the dynamic library used by Firefox to determine trusted root certificates with p11-kit-trust.so, which loads the system certificates. 80 | && rm -f /home/myuser/.cache/camoufox/libnssckbi.so \ 81 | && ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /home/myuser/.cache/camoufox/libnssckbi.so 82 | 83 | ENV APIFY_DEFAULT_BROWSER_PATH=/home/myuser/.cache/camoufox/camoufox-bin 84 | 85 | # Prevent installing of browsers by future `npm install`. 86 | ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 87 | 88 | # Set up xvfb 89 | ENV XVFB_WHD=1920x1080x24+32 90 | 91 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 92 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 93 | 94 | # NOTEs: 95 | # - This needs to be compatible with CLI. 96 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 97 | CMD ["npm", "start", "--silent"] 98 | -------------------------------------------------------------------------------- /node-playwright-firefox/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=20 2 | # Use bookworm to be consistent across node versions. 3 | FROM --platform=linux/amd64 node:${NODE_VERSION}-bookworm-slim 4 | 5 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using Firefox" 6 | ENV DEBIAN_FRONTEND=noninteractive 7 | 8 | COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh 9 | 10 | # Install Firefox dependencies + tools 11 | RUN sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list' \ 12 | && apt update \ 13 | && apt install -y --no-install-recommends \ 14 | # Found this in other images, not sure whether it's needed, it does not come from Playwright deps 15 | procps \ 16 | # The following packages are needed for the intermediate certificates to work in Firefox. 17 | ca-certificates \ 18 | jq \ 19 | wget \ 20 | p11-kit \ 21 | xauth \ 22 | \ 23 | # Register cerificates 24 | && chmod +x ./register_intermediate_certs.sh \ 25 | && ./register_intermediate_certs.sh \ 26 | \ 27 | # Add user so we don't need --no-sandbox. 28 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 29 | && mkdir -p /home/myuser/Downloads \ 30 | && chown -R myuser:myuser /home/myuser \ 31 | \ 32 | # Globally disable the update-notifier. 33 | && npm config --global set update-notifier false \ 34 | \ 35 | # Install all required playwright dependencies for firefox 36 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm_config_ignore_scripts=1 npx playwright install-deps firefox \ 37 | \ 38 | # Cleanup time 39 | && rm -rf /var/lib/apt/lists/* \ 40 | && rm -rf /src/*.deb \ 41 | && apt clean -y && apt autoremove -y \ 42 | && rm -rf /root/.npm \ 43 | # This is needed to remove an annoying error message when running headful. 44 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 45 | 46 | # Run everything after as non-privileged user. 47 | USER myuser 48 | WORKDIR /home/myuser 49 | 50 | ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers 51 | 52 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 53 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 54 | 55 | # Copy source code and xvfb script 56 | COPY --chown=myuser:myuser package.json main.js check-playwright-version.mjs firefox_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 57 | 58 | # Tell Node.js this is a production environemnt 59 | ENV NODE_ENV=production 60 | 61 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 62 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 63 | # However they did not think about all the sites there with large headers, 64 | # so we put back the old limit of 80kb, which seems to work just fine. 65 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 66 | 67 | # Install default dependencies, print versions of everything 68 | RUN npm --quiet set progress=false \ 69 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 70 | && echo "Installed NPM packages:" \ 71 | && (npm list --omit=dev --omit=optional || true) \ 72 | && echo "Node.js version:" \ 73 | && node --version \ 74 | && echo "NPM version:" \ 75 | && npm --version \ 76 | \ 77 | # symlink the firefox binary to the root folder in order to bypass the versioning and resulting browser launch crashes. 78 | && ln -s ${PLAYWRIGHT_BROWSERS_PATH}/firefox-*/firefox/firefox ${PLAYWRIGHT_BROWSERS_PATH}/ \ 79 | \ 80 | # Playwright allows downloading only one browser through separate package with same export. So we rename it to just playwright. 81 | && mv ./node_modules/playwright-firefox ./node_modules/playwright && rm -rf ./node_modules/playwright-firefox \ 82 | \ 83 | # Overrides the dynamic library used by Firefox to determine trusted root certificates with p11-kit-trust.so, which loads the system certificates. 84 | && rm -f $PLAYWRIGHT_BROWSERS_PATH/firefox-*/firefox/libnssckbi.so \ 85 | && ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so $(ls -d $PLAYWRIGHT_BROWSERS_PATH/firefox-*)/firefox/libnssckbi.so 86 | 87 | ENV APIFY_DEFAULT_BROWSER_PATH=${PLAYWRIGHT_BROWSERS_PATH}/firefox 88 | 89 | # Prevent installing of browsers by future `npm install`. 90 | ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 91 | 92 | # Set up xvfb 93 | ENV XVFB_WHD=1920x1080x24+32 94 | 95 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 96 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 97 | 98 | # NOTEs: 99 | # - This needs to be compatible with CLI. 100 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 101 | CMD ["npm", "start", "--silent"] 102 | -------------------------------------------------------------------------------- /python-selenium/Dockerfile: -------------------------------------------------------------------------------- 1 | # Get the Python version provided as a build argument 2 | ARG PYTHON_VERSION 3 | 4 | # Extend from the latest Debian and its slim version to keep the image as small as possible 5 | FROM python:${PYTHON_VERSION}-slim-trixie 6 | 7 | # Add labels to the image to identify it as an Apify Actor 8 | LABEL maintainer="support@apify.com" \ 9 | description="Base image for Apify Actors written in Python using Selenium" 10 | 11 | # Set the shell to use /bin/bash with specific options (see Hadolint DL4006) 12 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 13 | 14 | # Get the Apify Python SDK version provided as a build argument 15 | ARG APIFY_VERSION 16 | 17 | # Get the Selenium version provided as a build argument 18 | ARG SELENIUM_VERSION 19 | 20 | # Don't store bytecode, the Python app will be only run once 21 | ENV PYTHONDONTWRITEBYTECODE=1 22 | 23 | # Don't buffer output and flush it straight away 24 | ENV PYTHONUNBUFFERED=1 25 | 26 | # Don't use a cache dir 27 | ENV PIP_NO_CACHE_DIR=1 28 | 29 | # Disable warnings about outdated pip 30 | ENV PIP_DISABLE_PIP_VERSION_CHECK=1 31 | 32 | # Disable warnings about running pip as root 33 | ENV PIP_ROOT_USER_ACTION=ignore 34 | 35 | # Set up XVFB 36 | ENV XVFB_WHD=1920x1080x24+32 37 | 38 | # Setup the less privileged user 39 | RUN groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 40 | && mkdir -p /home/myuser/Downloads \ 41 | && chown -R myuser:myuser /home/myuser \ 42 | && mkdir -p /usr/src/app \ 43 | && chown -R myuser:myuser /usr/src/app \ 44 | && ln -s /usr/src/app /home/myuser \ 45 | # Install curl, firefox, jq, unzip, xvfb and dependencies of Chrome and its driver 46 | && apt update \ 47 | && apt install -y --no-install-recommends \ 48 | ca-certificates \ 49 | curl \ 50 | firefox-esr \ 51 | fonts-liberation \ 52 | jq \ 53 | libappindicator3-1 \ 54 | libasound2 \ 55 | libatk-bridge2.0-0 \ 56 | libgbm-dev \ 57 | libglib2.0-0 \ 58 | libgtk-3-0 \ 59 | libnspr4 \ 60 | libnss3 \ 61 | libx11-6 \ 62 | libx11-xcb1 \ 63 | libxcomposite1 \ 64 | libxcursor1 \ 65 | libxdamage1 \ 66 | libxext6 \ 67 | libxfixes3 \ 68 | libxi6 \ 69 | libxkbcommon0 \ 70 | libxrandr2 \ 71 | libxrender1 \ 72 | libxslt1.1 \ 73 | libxss1 \ 74 | libxt6 \ 75 | libxtst6 \ 76 | unzip \ 77 | xdg-utils \ 78 | xvfb \ 79 | xauth \ 80 | && apt autoremove -yqq --purge \ 81 | && apt clean \ 82 | && rm -rf /var/lib/apt/lists/* /var/log/* 83 | 84 | # Download and install Geckodriver 85 | RUN GECKO_DRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz" && \ 86 | curl --silent --show-error --location --output /tmp/geckodriver.tar.gz "$GECKO_DRIVER_URL" && \ 87 | tar --gzip --extract --file=/tmp/geckodriver.tar.gz --directory=/usr/local/bin && \ 88 | rm -f /tmp/geckodriver.tar.gz 89 | 90 | # Download and install Google Chrome 91 | RUN CHROME_URL="$( \ 92 | curl --silent --show-error --location https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | \ 93 | jq -r '.channels.Stable.downloads.chrome[] | select(.platform=="linux64") | .url' \ 94 | )" && \ 95 | curl --silent --show-error --location --output /tmp/chrome-linux64.zip "$CHROME_URL" && \ 96 | unzip /tmp/chrome-linux64.zip -d /opt/ && \ 97 | ln -s /opt/chrome-linux64/chrome /usr/bin/google-chrome && \ 98 | ln -s /opt/chrome-linux64/chrome /usr/bin/google-chrome-stable && \ 99 | rm -f /tmp/chrome-linux64.zip 100 | 101 | # Download and install Google Chrome driver 102 | RUN CHROME_DRIVER_URL="$( \ 103 | curl --silent --show-error --location https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | \ 104 | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform=="linux64") | .url' \ 105 | )" && \ 106 | curl --silent --show-error --location --output /tmp/chromedriver-linux64.zip "$CHROME_DRIVER_URL" && \ 107 | unzip /tmp/chromedriver-linux64.zip -d /usr/local/bin/ && \ 108 | rm -f /tmp/chromedriver-linux64.zip 109 | 110 | WORKDIR /usr/src/app 111 | 112 | ENV PATH="/root/.local/bin:/home/myuser/.local/bin:$PATH" 113 | 114 | # This instruction: 115 | # - Upgrades pip to the latest version 116 | # - Preinstalls the latest versions of setuptools and wheel to improve package installation speed 117 | # - Installs the specified version of the Apify Python SDK and Selenium 118 | RUN pip install --upgrade \ 119 | pip \ 120 | setuptools \ 121 | wheel \ 122 | apify~=${APIFY_VERSION} \ 123 | selenium~=${SELENIUM_VERSION} 124 | 125 | # Copy the dummy source code to the image 126 | COPY --chown=myuser:myuser . . 127 | 128 | # NOTE: This needs to be compatible with how Apify CLI launches Actors 129 | ENTRYPOINT ["./xvfb-entrypoint.sh"] 130 | CMD ["python3", "-m", "src"] 131 | -------------------------------------------------------------------------------- /node-playwright/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PLAYWRIGHT_VERSION= 2 | FROM --platform=linux/amd64 mcr.microsoft.com/playwright:${PLAYWRIGHT_VERSION}jammy 3 | 4 | ARG NODE_VERSION=20 5 | 6 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using headless Chrome" 7 | ENV DEBIAN_FRONTEND=noninteractive 8 | 9 | # Copy the script for registering intermediate certificates. 10 | COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh 11 | 12 | # Install libs 13 | RUN apt update \ 14 | && apt install --fix-missing -yq --no-install-recommends procps xvfb xauth wget \ 15 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \ 16 | # Uninstall system NodeJs 17 | && apt purge -yq nodejs \ 18 | # Install node 19 | && apt update && apt install -y curl \ 20 | && curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ 21 | && apt install -y nodejs \ 22 | # The following packages are needed for the intermediate certificates to work in Firefox. 23 | ca-certificates \ 24 | jq \ 25 | wget \ 26 | p11-kit \ 27 | # Register cerificates 28 | && chmod +x ./register_intermediate_certs.sh \ 29 | && ./register_intermediate_certs.sh \ 30 | # Disable chrome auto updates, based on https://support.google.com/chrome/a/answer/9052345 31 | && mkdir -p /etc/default && echo 'repo_add_once=false' > /etc/default/google-chrome \ 32 | # Install chrome 33 | && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -nv \ 34 | && apt install --fix-missing -yq ./google-chrome-stable_current_amd64.deb && rm ./google-chrome-stable_current_amd64.deb \ 35 | \ 36 | # Add user so we don't need --no-sandbox. 37 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 38 | && mkdir -p /home/myuser/Downloads \ 39 | && chown -R myuser:myuser /home/myuser \ 40 | \ 41 | && mkdir -p /etc/opt/chrome/policies/managed \ 42 | && echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > /etc/opt/chrome/policies/managed/managed_policies.json \ 43 | && echo '{ "ComponentUpdatesEnabled": false }' > /etc/opt/chrome/policies/managed/component_update.json \ 44 | \ 45 | # Globally disable the update-notifier. 46 | && npm config --global set update-notifier false \ 47 | \ 48 | # Final cleanup 49 | # Cleanup time 50 | && rm -rf /var/lib/apt/lists/* \ 51 | && rm -rf /src/*.deb \ 52 | && apt clean -y && apt autoremove -y \ 53 | && rm -rf /root/.npm \ 54 | # This is needed to remove an annoying error message when running headful. 55 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 56 | 57 | # Run everything after as non-privileged user. 58 | USER myuser 59 | WORKDIR /home/myuser 60 | 61 | # Point playwright to the preincluded browsers - moving browsers around increases the image size a *lot* 62 | ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright 63 | 64 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 65 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 66 | 67 | # Copy source code and xvfb script 68 | COPY --chown=myuser:myuser package.json main.js check-playwright-version.mjs chrome_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 69 | 70 | # Sets path to Chrome executable, this is used by Apify.launchPuppeteer() 71 | ENV APIFY_CHROME_EXECUTABLE_PATH=/usr/bin/google-chrome 72 | 73 | # Tell Node.js this is a production environemnt 74 | ENV NODE_ENV=production 75 | 76 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 77 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 78 | # However they did not think about all the sites there with large headers, 79 | # so we put back the old limit of 80kb, which seems to work just fine. 80 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 81 | 82 | # Install default dependencies, print versions of everything 83 | RUN npm --quiet set progress=false \ 84 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 85 | && echo "Installed NPM packages:" \ 86 | && (npm list --omit=dev --omit=optional || true) \ 87 | && echo "Node.js version:" \ 88 | && node --version \ 89 | && echo "NPM version:" \ 90 | && npm --version \ 91 | && echo "Google Chrome version:" \ 92 | && bash -c "$APIFY_CHROME_EXECUTABLE_PATH --version" \ 93 | # Overrides the dynamic library used by Firefox to determine trusted root certificates with p11-kit-trust.so, which loads the system certificates. 94 | && rm -f $PLAYWRIGHT_BROWSERS_PATH/firefox-*/firefox/libnssckbi.so \ 95 | && ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so $(ls -d $PLAYWRIGHT_BROWSERS_PATH/firefox-*)/firefox/libnssckbi.so 96 | 97 | # Set up xvfb 98 | ENV XVFB_WHD=1920x1080x24+32 99 | 100 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 101 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 102 | 103 | # NOTEs: 104 | # - This needs to be compatible with CLI. 105 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 106 | CMD ["npm", "start", "--silent"] 107 | -------------------------------------------------------------------------------- /node-puppeteer-chrome/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=20 2 | # Use bookworm to be consistent across node versions. 3 | FROM --platform=linux/amd64 node:${NODE_VERSION}-bookworm-slim 4 | 5 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using headless Chrome" 6 | ENV DEBIAN_FRONTEND=noninteractive 7 | 8 | # This image was inspired by https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker 9 | 10 | # Install latest Chrome dev packages and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) 11 | # Note: this also installs the necessary libs to make the bundled version of Chromium that Puppeteer installs work. 12 | RUN apt update \ 13 | && apt install -y wget gnupg unzip ca-certificates --no-install-recommends \ 14 | && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ 15 | && sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ 16 | && sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list' \ 17 | && apt update \ 18 | && apt purge --auto-remove -y unzip \ 19 | && apt install -y \ 20 | fonts-freefont-ttf \ 21 | fonts-ipafont-gothic \ 22 | fonts-kacst \ 23 | fonts-liberation \ 24 | fonts-thai-tlwg \ 25 | fonts-wqy-zenhei \ 26 | git \ 27 | libxss1 \ 28 | lsb-release \ 29 | procps \ 30 | xdg-utils \ 31 | xvfb \ 32 | xauth \ 33 | --no-install-recommends \ 34 | # Disable chrome auto updates, based on https://support.google.com/chrome/a/answer/9052345 35 | && mkdir -p /etc/default && echo 'repo_add_once=false' > /etc/default/google-chrome \ 36 | \ 37 | # Install chrome 38 | && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -nv \ 39 | && apt install --fix-missing -yq ./google-chrome-stable_current_amd64.deb && rm ./google-chrome-stable_current_amd64.deb \ 40 | \ 41 | # Add user so we don't need --no-sandbox. 42 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 43 | && mkdir -p /home/myuser/Downloads \ 44 | && chown -R myuser:myuser /home/myuser \ 45 | \ 46 | && mkdir -p /etc/opt/chrome/policies/managed \ 47 | && echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > /etc/opt/chrome/policies/managed/managed_policies.json \ 48 | && echo '{ "ComponentUpdatesEnabled": false }' > /etc/opt/chrome/policies/managed/component_update.json \ 49 | \ 50 | # Globally disable the update-notifier. 51 | && npm config --global set update-notifier false \ 52 | # Cleanup 53 | && rm -rf /var/lib/apt/lists/* \ 54 | && rm -rf /src/*.deb \ 55 | && apt clean -y && apt autoremove -y \ 56 | && rm -rf /root/.npm \ 57 | # This is needed to remove an annoying error message when running headful. 58 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 59 | 60 | # Run everything after as non-privileged user. 61 | USER myuser 62 | WORKDIR /home/myuser 63 | 64 | # Copy source code and xvfb script 65 | COPY --chown=myuser:myuser package.json main.js check-puppeteer-version.mjs puppeteer_*.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 66 | 67 | # Uncomment to skip the chromium download when installing puppeteer. If you do, 68 | # you'll need to launch puppeteer with: 69 | # browser.launch({executablePath: 'google-chrome'}) 70 | # ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true 71 | 72 | # Sets path to Chrome executable, this is used by Apify.launchPuppeteer() 73 | ENV APIFY_CHROME_EXECUTABLE_PATH=/usr/bin/google-chrome 74 | 75 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 76 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 77 | 78 | # Tell Node.js this is a production environemnt 79 | ENV NODE_ENV=production 80 | 81 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 82 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 83 | # However they did not think about all the sites there with large headers, 84 | # so we put back the old limit of 80kb, which seems to work just fine. 85 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 86 | 87 | # Install default dependencies, print versions of everything 88 | RUN npm --quiet set progress=false \ 89 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 90 | && echo "Installed NPM packages:" \ 91 | && (npm list --omit=dev --omit=optional || true) \ 92 | && echo "Node.js version:" \ 93 | && node --version \ 94 | && echo "NPM version:" \ 95 | && npm --version \ 96 | && echo "Google Chrome version:" \ 97 | && bash -c "$APIFY_CHROME_EXECUTABLE_PATH --version" 98 | 99 | # Set up xvfb 100 | ENV XVFB_WHD=1920x1080x24+32 101 | 102 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 103 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 104 | 105 | # NOTEs: 106 | # - This needs to be compatible with CLI. 107 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 108 | CMD ["npm", "start", "--silent"] 109 | -------------------------------------------------------------------------------- /node-playwright-chrome/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_VERSION=20 2 | # Use bookworm to be consistent across node versions. 3 | FROM --platform=linux/amd64 node:${NODE_VERSION}-bookworm-slim 4 | 5 | LABEL maintainer="support@apify.com" description="Base image for Apify Actors using Chrome" 6 | ENV DEBIAN_FRONTEND=noninteractive 7 | 8 | # This image was inspired by https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker 9 | 10 | # Install latest Chrome dev packages and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) 11 | # Note: this also installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work. 12 | RUN \ 13 | # Disable chrome auto updates, based on https://support.google.com/chrome/a/answer/9052345 14 | mkdir -p /etc/default && echo 'repo_add_once=false' > /etc/default/google-chrome \ 15 | && apt update \ 16 | && apt install -y wget gnupg unzip ca-certificates xvfb xauth --no-install-recommends \ 17 | && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ 18 | && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ 19 | && sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list' \ 20 | && apt update \ 21 | && apt purge --auto-remove -y wget unzip \ 22 | && apt install -y \ 23 | git \ 24 | google-chrome-stable \ 25 | # Found this in other images, not sure whether it's needed, it does not come from Playwright deps 26 | procps \ 27 | # Extras 28 | fonts-freefont-ttf \ 29 | fonts-kacst \ 30 | fonts-thai-tlwg \ 31 | fonts-wqy-zenhei \ 32 | --no-install-recommends \ 33 | \ 34 | # Add user so we don't need --no-sandbox. 35 | && groupadd -r myuser && useradd -r -g myuser -G audio,video myuser \ 36 | && mkdir -p /home/myuser/Downloads \ 37 | && chown -R myuser:myuser /home/myuser \ 38 | \ 39 | && mkdir -p /etc/opt/chrome/policies/managed \ 40 | && echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > /etc/opt/chrome/policies/managed/managed_policies.json \ 41 | && echo '{ "ComponentUpdatesEnabled": false }' > /etc/opt/chrome/policies/managed/component_update.json \ 42 | \ 43 | # Globally disable the update-notifier. 44 | && npm config --global set update-notifier false \ 45 | # Install all required playwright dependencies for chrome/chromium 46 | && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm_config_ignore_scripts=1 npx playwright install-deps chrome \ 47 | # Cleanup time 48 | && rm -rf /var/lib/apt/lists/* \ 49 | && rm -rf /src/*.deb \ 50 | && apt clean -y && apt autoremove -y \ 51 | && rm -rf /root/.npm \ 52 | # This is needed to remove an annoying error message when running headful. 53 | && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix 54 | 55 | # Run everything after as non-privileged user. 56 | USER myuser 57 | WORKDIR /home/myuser 58 | 59 | ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers 60 | 61 | # Copy source code and xvfb script 62 | COPY --chown=myuser:myuser package.json main.js check-playwright-version.mjs chrome_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh xvfb-entrypoint.sh /home/myuser/ 63 | 64 | # Sets path to Chrome executable, this is used by Apify.launchPuppeteer() 65 | ENV APIFY_CHROME_EXECUTABLE_PATH=/usr/bin/google-chrome 66 | 67 | # Tell the crawlee cli that we already have browers installed, so it skips installing them 68 | ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 69 | 70 | # Tell Node.js this is a production environemnt 71 | ENV NODE_ENV=production 72 | 73 | # Enable Node.js process to use a lot of memory (Actor has limit of 32GB) 74 | # Increases default size of headers. The original limit was 80kb, but from node 10+ they decided to lower it to 8kb. 75 | # However they did not think about all the sites there with large headers, 76 | # so we put back the old limit of 80kb, which seems to work just fine. 77 | ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000" 78 | 79 | # Install default dependencies, print versions of everything 80 | RUN npm --quiet set progress=false \ 81 | && npm install --omit=dev --omit=optional --no-package-lock --prefer-online \ 82 | && echo "Installed NPM packages:" \ 83 | && (npm list --omit=dev --omit=optional || true) \ 84 | && echo "Node.js version:" \ 85 | && node --version \ 86 | && echo "NPM version:" \ 87 | && npm --version \ 88 | && echo "Google Chrome version:" \ 89 | && bash -c "$APIFY_CHROME_EXECUTABLE_PATH --version" \ 90 | # symlink the chromium binary to the root folder in order to bypass the versioning and resulting browser launch crashes. 91 | && ln -s ${PLAYWRIGHT_BROWSERS_PATH}/chromium-*/chrome-linux*/chrome ${PLAYWRIGHT_BROWSERS_PATH}/ \ 92 | # Playwright allows downloading only one browser through separate package with same export. So we rename it to just playwright. 93 | && mv ./node_modules/playwright-chromium ./node_modules/playwright && rm -rf ./node_modules/playwright-chromium 94 | 95 | ENV APIFY_DEFAULT_BROWSER_PATH=${PLAYWRIGHT_BROWSERS_PATH}/chrome 96 | 97 | # Prevent installing of browsers by future `npm install`. 98 | ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 99 | 100 | # Set up xvfb 101 | ENV XVFB_WHD=1920x1080x24+32 102 | 103 | # The entrypoint script will be the one handling the CMD passed in, and will always wrap it into xvfb-run 104 | ENTRYPOINT ["/home/myuser/xvfb-entrypoint.sh"] 105 | 106 | # NOTEs: 107 | # - This needs to be compatible with CLI. 108 | # - Using CMD instead of ENTRYPOINT, to allow manual overriding 109 | CMD ["npm", "start", "--silent"] 110 | -------------------------------------------------------------------------------- /.github/workflows/release-python.yaml: -------------------------------------------------------------------------------- 1 | name: Python basic images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: 'Tag for the images (e.g.: "latest" or "beta")' 8 | required: true 9 | apify_version: 10 | description: 'Apify Python SDK version (e.g.: "1.0.0"). If missing, the latest version will be used.' 11 | required: false 12 | rebuild_images: 13 | description: "Rebuilds images even if the cache state matches the current state." 14 | required: false 15 | type: boolean 16 | 17 | repository_dispatch: 18 | types: [build-python-images] 19 | 20 | pull_request: 21 | 22 | schedule: 23 | - cron: 0 */2 * * * 24 | 25 | env: 26 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 27 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 28 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 29 | 30 | jobs: 31 | matrix: 32 | runs-on: ubuntu-latest 33 | outputs: 34 | matrix: ${{ steps.set-matrix.outputs.matrix }} 35 | 36 | steps: 37 | - uses: actions/checkout@v6 38 | with: 39 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 40 | fetch-depth: 0 41 | 42 | - name: Set up Node.js 43 | uses: actions/setup-node@v6 44 | with: 45 | node-version-file: .github/actions/version-matrix/package.json 46 | cache: yarn 47 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 48 | 49 | - run: yarn 50 | working-directory: ./.github/actions/version-matrix 51 | 52 | - name: Generate matrix 53 | id: set-matrix 54 | run: echo "matrix=$(yarn python:normal)" >> $GITHUB_OUTPUT 55 | working-directory: ./.github/actions/version-matrix 56 | 57 | - name: Print matrix 58 | run: | 59 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "python-version=\(.["python-version"]) apify-version=\(.["apify-version"])"' 60 | echo "" 61 | echo "Raw matrix:" 62 | echo "" 63 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 64 | 65 | - name: Push updated matrix 66 | if: github.event_name != 'pull_request' 67 | run: | 68 | # Setup git user 69 | git config --global user.email "noreply@apify.com" 70 | git config --global user.name "Apify CI Bot" 71 | git config pull.rebase true 72 | 73 | # Add and commit if there are changes 74 | git add ./.github/actions/version-matrix/data/*.json 75 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} python:normal cache" 76 | 77 | # Try to push 5 times, with pulls between retries 78 | for i in {1..5}; do 79 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 80 | done 81 | 82 | # Build master images that are not dependent on existing builds. 83 | build-main: 84 | needs: [matrix] 85 | 86 | runs-on: ubuntu-latest 87 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 88 | 89 | strategy: 90 | fail-fast: false 91 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 92 | 93 | name: "py: ${{ matrix.python-version }} apify: ${{ matrix.apify-version }}" 94 | 95 | steps: 96 | - name: Set default inputs if event is pull request 97 | if: github.event_name == 'pull_request' 98 | run: | 99 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 100 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 101 | 102 | - name: Set default inputs if event is schedule 103 | if: github.event_name == 'schedule' 104 | run: | 105 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 106 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 107 | 108 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 109 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 110 | run: | 111 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 112 | 113 | - name: Check if inputs are set correctly 114 | run: | 115 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 116 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 117 | 118 | - name: Checkout 119 | uses: actions/checkout@v6 120 | 121 | - name: Set up Python ${{ matrix.python-version }} 122 | uses: actions/setup-python@v6 123 | with: 124 | python-version: ${{ matrix.python-version }} 125 | 126 | - name: Update pip 127 | run: python -m pip install --upgrade pip 128 | 129 | - # It seems that it takes a few minutes before a newly published version 130 | # becomes available in the PyPI registry. We wait before starting the image builds. 131 | name: Wait For Package Registry 132 | uses: nick-fields/retry@v3 133 | with: 134 | timeout_minutes: 2 # timeout for a single attempt 135 | max_attempts: 5 136 | retry_wait_seconds: 60 # wait between retries 137 | command: pip install apify~=$APIFY_VERSION 138 | 139 | - name: Prepare image tags 140 | id: prepare-tags 141 | uses: actions/github-script@v8 142 | env: 143 | CURRENT_PYTHON: ${{ matrix.python-version }} 144 | LATEST_PYTHON: ${{ matrix.latest-python-version }} 145 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 146 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 147 | # Force this to true, as these images have no browsers 148 | IS_LATEST_BROWSER_IMAGE: "true" 149 | with: 150 | script: | 151 | const generateTags = require("./.github/scripts/prepare-python-image-tags.js"); 152 | return generateTags() 153 | 154 | - name: Set up QEMU 155 | uses: docker/setup-qemu-action@v3 156 | 157 | - name: Set up Docker Buildx 158 | uses: docker/setup-buildx-action@v3 159 | 160 | - name: Build and tag image 161 | uses: docker/build-push-action@v6 162 | with: 163 | context: ./${{ matrix.image-name }} 164 | file: ./${{ matrix.image-name }}/Dockerfile 165 | build-args: | 166 | PYTHON_VERSION=${{ matrix.python-version }} 167 | APIFY_VERSION=${{ env.APIFY_VERSION }} 168 | load: true 169 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 170 | 171 | - name: Test image 172 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 173 | 174 | - name: Login to DockerHub 175 | if: github.event_name != 'pull_request' 176 | uses: docker/login-action@v3 177 | with: 178 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 179 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 180 | 181 | - name: Push images 182 | if: github.event_name != 'pull_request' 183 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 184 | -------------------------------------------------------------------------------- /.github/workflows/release-python-selenium.yaml: -------------------------------------------------------------------------------- 1 | name: Python + Selenium images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: 'Tag for the images (e.g.: "latest" or "beta")' 8 | required: true 9 | apify_version: 10 | description: 'Apify Python SDK version (e.g.: "1.0.0"). If missing, the latest version will be used.' 11 | required: false 12 | rebuild_images: 13 | description: "Rebuilds images even if the cache state matches the current state." 14 | required: false 15 | type: boolean 16 | 17 | repository_dispatch: 18 | types: [build-python-images] 19 | 20 | pull_request: 21 | 22 | schedule: 23 | - cron: 0 */2 * * * 24 | 25 | env: 26 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 27 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 28 | SHOULD_USE_LAST_FIVE: ${{ github.event_name != 'pull_request' }} 29 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 30 | 31 | jobs: 32 | matrix: 33 | runs-on: ubuntu-latest 34 | outputs: 35 | matrix: ${{ steps.set-matrix.outputs.matrix }} 36 | 37 | steps: 38 | - uses: actions/checkout@v6 39 | with: 40 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 41 | fetch-depth: 0 42 | 43 | - name: Set up Node.js 44 | uses: actions/setup-node@v6 45 | with: 46 | node-version-file: .github/actions/version-matrix/package.json 47 | cache: yarn 48 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 49 | 50 | - run: yarn 51 | working-directory: ./.github/actions/version-matrix 52 | 53 | - name: Generate matrix 54 | id: set-matrix 55 | run: echo "matrix=$(yarn python:selenium)" >> $GITHUB_OUTPUT 56 | working-directory: ./.github/actions/version-matrix 57 | 58 | - name: Print matrix 59 | run: | 60 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "python-version=\(.["python-version"]) selenium-version=\(.["selenium-version"]) apify-version=\(.["apify-version"]) is-latest=\(.["is-latest"])"' 61 | echo "" 62 | echo "Raw matrix:" 63 | echo "" 64 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 65 | 66 | - name: Push updated matrix 67 | if: github.event_name != 'pull_request' 68 | run: | 69 | # Setup git user 70 | git config --global user.email "noreply@apify.com" 71 | git config --global user.name "Apify CI Bot" 72 | git config pull.rebase true 73 | 74 | # Add and commit if there are changes 75 | git add ./.github/actions/version-matrix/data/*.json 76 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} python:selenium cache" 77 | 78 | # Try to push 5 times, with pulls between retries 79 | for i in {1..5}; do 80 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 81 | done 82 | 83 | # Build master images that are not dependent on existing builds. 84 | build-main: 85 | needs: [matrix] 86 | 87 | runs-on: ubuntu-latest 88 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 89 | 90 | strategy: 91 | fail-fast: false 92 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 93 | 94 | name: "py: ${{ matrix.python-version }}, selenium: ${{ matrix.selenium-version }}, apify: ${{ matrix.apify-version }}, is-latest: ${{ matrix.is-latest }}" 95 | 96 | steps: 97 | - name: Set default inputs if event is pull request 98 | if: github.event_name == 'pull_request' 99 | run: | 100 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 101 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 102 | 103 | - name: Set default inputs if event is schedule 104 | if: github.event_name == 'schedule' 105 | run: | 106 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 107 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 108 | 109 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 110 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 111 | run: | 112 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 113 | 114 | - name: Check if inputs are set correctly 115 | run: | 116 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 117 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 118 | 119 | - name: Checkout 120 | uses: actions/checkout@v6 121 | 122 | - name: Set up Python ${{ matrix.python-version }} 123 | uses: actions/setup-python@v6 124 | with: 125 | python-version: ${{ matrix.python-version }} 126 | 127 | - name: Update pip 128 | run: python -m pip install --upgrade pip 129 | 130 | - # It seems that it takes a few minutes before a newly published version 131 | # becomes available in the PyPI registry. We wait before starting the image builds. 132 | name: Wait For Package Registry 133 | uses: nick-fields/retry@v3 134 | with: 135 | timeout_minutes: 2 # timeout for a single attempt 136 | max_attempts: 3 137 | retry_wait_seconds: 60 # wait between retries 138 | command: pip install apify~=$APIFY_VERSION 139 | 140 | - name: Prepare image tags 141 | id: prepare-tags 142 | uses: actions/github-script@v8 143 | env: 144 | CURRENT_PYTHON: ${{ matrix.python-version }} 145 | LATEST_PYTHON: ${{ matrix.latest-python-version }} 146 | FRAMEWORK_VERSION: ${{ matrix.selenium-version }} 147 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 148 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 149 | IS_LATEST_BROWSER_IMAGE: ${{ matrix.is-latest }} 150 | with: 151 | script: | 152 | const generateTags = require("./.github/scripts/prepare-python-image-tags.js"); 153 | return generateTags() 154 | 155 | - name: Set up QEMU 156 | uses: docker/setup-qemu-action@v3 157 | 158 | - name: Set up Docker Buildx 159 | uses: docker/setup-buildx-action@v3 160 | 161 | - name: Build and tag image 162 | uses: docker/build-push-action@v6 163 | with: 164 | context: ./${{ matrix.image-name }} 165 | file: ./${{ matrix.image-name }}/Dockerfile 166 | build-args: | 167 | PYTHON_VERSION=${{ matrix.python-version }} 168 | APIFY_VERSION=${{ env.APIFY_VERSION }} 169 | SELENIUM_VERSION=${{ matrix.selenium-version }} 170 | load: true 171 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 172 | 173 | - name: Test image 174 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 175 | 176 | - name: Login to DockerHub 177 | if: github.event_name != 'pull_request' 178 | uses: docker/login-action@v3 179 | with: 180 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 181 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 182 | 183 | - name: Push images 184 | if: github.event_name != 'pull_request' 185 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 186 | -------------------------------------------------------------------------------- /.github/workflows/release-python-playwright.yaml: -------------------------------------------------------------------------------- 1 | name: Python + Playwright images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: 'Tag for the images (e.g.: "latest" or "beta")' 8 | required: true 9 | apify_version: 10 | description: 'Apify Python SDK version (e.g.: "1.0.0"). If missing, the latest version will be used.' 11 | required: false 12 | rebuild_images: 13 | description: "Rebuilds images even if the cache state matches the current state." 14 | required: false 15 | type: boolean 16 | 17 | repository_dispatch: 18 | types: [build-python-images] 19 | 20 | pull_request: 21 | 22 | schedule: 23 | - cron: 0 */2 * * * 24 | 25 | env: 26 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 27 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 28 | SHOULD_USE_LAST_FIVE: ${{ github.event_name != 'pull_request' }} 29 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 30 | 31 | jobs: 32 | matrix: 33 | runs-on: ubuntu-latest 34 | outputs: 35 | matrix: ${{ steps.set-matrix.outputs.matrix }} 36 | 37 | steps: 38 | - uses: actions/checkout@v6 39 | with: 40 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 41 | fetch-depth: 0 42 | 43 | - name: Set up Node.js 44 | uses: actions/setup-node@v6 45 | with: 46 | node-version-file: .github/actions/version-matrix/package.json 47 | cache: yarn 48 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 49 | 50 | - run: yarn 51 | working-directory: ./.github/actions/version-matrix 52 | 53 | - name: Generate matrix 54 | id: set-matrix 55 | run: echo "matrix=$(yarn python:playwright)" >> $GITHUB_OUTPUT 56 | working-directory: ./.github/actions/version-matrix 57 | 58 | - name: Print matrix 59 | run: | 60 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "python-version=\(.["python-version"]) playwright-version=\(.["playwright-version"]) apify-version=\(.["apify-version"]) is-latest=\(.["is-latest"])"' 61 | echo "" 62 | echo "Raw matrix:" 63 | echo "" 64 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 65 | 66 | - name: Push updated matrix 67 | if: github.event_name != 'pull_request' 68 | run: | 69 | # Setup git user 70 | git config --global user.email "noreply@apify.com" 71 | git config --global user.name "Apify CI Bot" 72 | git config pull.rebase true 73 | 74 | # Add and commit if there are changes 75 | git add ./.github/actions/version-matrix/data/*.json 76 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} python:playwright cache" 77 | 78 | # Try to push 5 times, with pulls between retries 79 | for i in {1..5}; do 80 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 81 | done 82 | 83 | # Build master images that are not dependent on existing builds. 84 | build-main: 85 | needs: [matrix] 86 | 87 | runs-on: ubuntu-latest 88 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 89 | 90 | strategy: 91 | fail-fast: false 92 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 93 | 94 | name: "py: ${{ matrix.python-version }}, pw: ${{ matrix.playwright-version }}, apify: ${{ matrix.apify-version }}, is-latest: ${{ matrix.is-latest }}" 95 | 96 | steps: 97 | - name: Set default inputs if event is pull request 98 | if: github.event_name == 'pull_request' 99 | run: | 100 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 101 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 102 | 103 | - name: Set default inputs if event is schedule 104 | if: github.event_name == 'schedule' 105 | run: | 106 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 107 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 108 | 109 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 110 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 111 | run: | 112 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 113 | 114 | - name: Check if inputs are set correctly 115 | run: | 116 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 117 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 118 | 119 | - name: Checkout 120 | uses: actions/checkout@v6 121 | 122 | - name: Set up Python ${{ matrix.python-version }} 123 | uses: actions/setup-python@v6 124 | with: 125 | python-version: ${{ matrix.python-version }} 126 | 127 | - name: Update pip 128 | run: python -m pip install --upgrade pip 129 | 130 | - # It seems that it takes a few minutes before a newly published version 131 | # becomes available in the PyPI registry. We wait before starting the image builds. 132 | name: Wait For Package Registry 133 | uses: nick-fields/retry@v3 134 | with: 135 | timeout_minutes: 2 # timeout for a single attempt 136 | max_attempts: 5 137 | retry_wait_seconds: 60 # wait between retries 138 | command: pip install apify~=$APIFY_VERSION 139 | 140 | - name: Prepare image tags 141 | id: prepare-tags 142 | uses: actions/github-script@v8 143 | env: 144 | CURRENT_PYTHON: ${{ matrix.python-version }} 145 | LATEST_PYTHON: ${{ matrix.latest-python-version }} 146 | FRAMEWORK_VERSION: ${{ matrix.playwright-version }} 147 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 148 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 149 | IS_LATEST_BROWSER_IMAGE: ${{ matrix.is-latest }} 150 | with: 151 | script: | 152 | const generateTags = require("./.github/scripts/prepare-python-image-tags.js"); 153 | return generateTags() 154 | 155 | - name: Set up QEMU 156 | uses: docker/setup-qemu-action@v3 157 | 158 | - name: Set up Docker Buildx 159 | uses: docker/setup-buildx-action@v3 160 | 161 | - name: Build and tag image 162 | uses: docker/build-push-action@v6 163 | with: 164 | context: ./${{ matrix.image-name }} 165 | file: ./${{ matrix.image-name }}/Dockerfile 166 | build-args: | 167 | PYTHON_VERSION=${{ matrix.python-version }} 168 | APIFY_VERSION=${{ env.APIFY_VERSION }} 169 | PLAYWRIGHT_VERSION=${{ matrix.playwright-version }} 170 | load: true 171 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 172 | 173 | - name: Test image 174 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 175 | 176 | - name: Login to DockerHub 177 | if: github.event_name != 'pull_request' 178 | uses: docker/login-action@v3 179 | with: 180 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 181 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 182 | 183 | - name: Push images 184 | if: github.event_name != 'pull_request' 185 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 186 | -------------------------------------------------------------------------------- /.github/workflows/release-node.yaml: -------------------------------------------------------------------------------- 1 | name: Node basic images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: "Tag for the images (e.g.: beta)" 8 | required: true 9 | apify_version: 10 | description: "Apify SDK version (e.g.: ^1.0.0). If missing, the latest version will be used." 11 | required: false 12 | crawlee_version: 13 | description: "Crawlee version (e.g.: ^1.0.0). If missing, the latest version will be used." 14 | required: false 15 | rebuild_images: 16 | description: "Rebuilds images even if the cache state matches the current state." 17 | required: false 18 | type: boolean 19 | 20 | repository_dispatch: 21 | types: 22 | - build-node-images 23 | 24 | pull_request: 25 | 26 | schedule: 27 | - cron: 0 */2 * * * 28 | 29 | env: 30 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 31 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 32 | CRAWLEE_VERSION: ${{ github.event.inputs.crawlee_version || github.event.client_payload.crawlee_version }} 33 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 34 | 35 | jobs: 36 | matrix: 37 | runs-on: ubuntu-latest 38 | outputs: 39 | matrix: ${{ steps.set-matrix.outputs.matrix }} 40 | 41 | steps: 42 | - uses: actions/checkout@v6 43 | with: 44 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 45 | fetch-depth: 0 46 | 47 | - name: Set up Node.js 48 | uses: actions/setup-node@v6 49 | with: 50 | node-version-file: .github/actions/version-matrix/package.json 51 | cache: yarn 52 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 53 | 54 | - run: yarn 55 | working-directory: ./.github/actions/version-matrix 56 | 57 | - name: Generate matrix 58 | id: set-matrix 59 | run: echo "matrix=$(yarn node:normal)" >> $GITHUB_OUTPUT 60 | working-directory: ./.github/actions/version-matrix 61 | 62 | - name: Print matrix 63 | run: | 64 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "node-version=\(.["node-version"]) apify-version=\(.["apify-version"]) crawlee-version=\(.["crawlee-version"])"' 65 | echo "" 66 | echo "Raw matrix:" 67 | echo "" 68 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 69 | 70 | - name: Push updated matrix 71 | if: github.event_name != 'pull_request' 72 | run: | 73 | # Setup git user 74 | git config --global user.email "noreply@apify.com" 75 | git config --global user.name "Apify CI Bot" 76 | git config pull.rebase true 77 | 78 | # Add and commit if there are changes 79 | git add ./.github/actions/version-matrix/data/*.json 80 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} node:normal cache" 81 | 82 | # Try to push 5 times, with pulls between retries 83 | for i in {1..5}; do 84 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 85 | done 86 | 87 | # Build master images that are not dependent on existing builds. 88 | build-main: 89 | needs: [matrix] 90 | 91 | runs-on: ubuntu-latest 92 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 93 | 94 | strategy: 95 | fail-fast: false 96 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 97 | 98 | name: "node: ${{ matrix.node-version }} apify: ${{ matrix.apify-version }} crawlee: ${{ matrix.crawlee-version }}" 99 | 100 | steps: 101 | - name: Set default inputs if event is pull request 102 | if: github.event_name == 'pull_request' 103 | run: | 104 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 105 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 106 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 107 | 108 | - name: Set default inputs if event is schedule 109 | if: github.event_name == 'schedule' 110 | run: | 111 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 112 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 113 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 114 | 115 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 116 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 117 | run: | 118 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 119 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 120 | 121 | - name: Check if inputs are set correctly 122 | run: | 123 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 124 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 125 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION input is empty!" >&2; exit 1; fi 126 | 127 | - name: Checkout 128 | uses: actions/checkout@v6 129 | 130 | - name: Set up Node ${{ matrix.node-version }} 131 | uses: actions/setup-node@v6 132 | with: 133 | node-version: ${{ matrix.node-version }} 134 | 135 | - name: Set Dependency Versions 136 | run: | 137 | cd ${{ matrix.image-name }} 138 | node ../.github/scripts/set-dependency-versions.js 139 | 140 | - # It seems that it takes at least two minutes before a newly published version 141 | # becomes available in the NPM registry. We wait before starting the image builds. 142 | name: Wait For Package Registry 143 | uses: nick-fields/retry@v3 144 | with: 145 | timeout_minutes: 2 # timeout for a single attempt 146 | max_attempts: 5 147 | retry_wait_seconds: 60 # wait between retries 148 | command: cd ${{ matrix.image-name }} && npm i --dry-run 149 | 150 | - name: Prepare image tags 151 | id: prepare-tags 152 | uses: actions/github-script@v8 153 | env: 154 | CURRENT_NODE: ${{ matrix.node-version }} 155 | LATEST_NODE: ${{ matrix.latest-node-version }} 156 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 157 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 158 | # Force this to true, as these images have no browsers 159 | IS_LATEST_BROWSER_IMAGE: "true" 160 | with: 161 | script: | 162 | const generateTags = require("./.github/scripts/prepare-node-image-tags.js"); 163 | return generateTags(); 164 | 165 | - name: Set up QEMU 166 | uses: docker/setup-qemu-action@v3 167 | 168 | - name: Set up Docker Buildx 169 | uses: docker/setup-buildx-action@v3 170 | 171 | - name: Build and tag image 172 | uses: docker/build-push-action@v6 173 | with: 174 | context: ./${{ matrix.image-name }} 175 | file: ./${{ matrix.image-name }}/Dockerfile 176 | build-args: NODE_VERSION=${{ matrix.node-version }} 177 | load: true 178 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 179 | 180 | - name: Test image 181 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 182 | 183 | - name: Login to DockerHub 184 | if: github.event_name != 'pull_request' 185 | uses: docker/login-action@v3 186 | with: 187 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 188 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 189 | 190 | - name: Push images 191 | if: github.event_name != 'pull_request' 192 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 193 | -------------------------------------------------------------------------------- /.github/workflows/release-node-puppeteer.yaml: -------------------------------------------------------------------------------- 1 | name: Node + Puppeteer images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: "Tag for the images (e.g.: beta)" 8 | required: true 9 | apify_version: 10 | description: "Apify SDK version (e.g.: ^1.0.0). If missing, the latest version will be used." 11 | required: false 12 | crawlee_version: 13 | description: "Crawlee version (e.g.: ^1.0.0). If missing, the latest version will be used." 14 | required: false 15 | rebuild_images: 16 | description: "Rebuilds images even if the cache state matches the current state." 17 | required: false 18 | type: boolean 19 | 20 | repository_dispatch: 21 | types: 22 | - build-node-images 23 | 24 | pull_request: 25 | 26 | schedule: 27 | - cron: 0 */2 * * * 28 | 29 | env: 30 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 31 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 32 | CRAWLEE_VERSION: ${{ github.event.inputs.crawlee_version || github.event.client_payload.crawlee_version }} 33 | SHOULD_USE_LAST_FIVE: ${{ github.event_name != 'pull_request' }} 34 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 35 | 36 | jobs: 37 | matrix: 38 | runs-on: ubuntu-latest 39 | outputs: 40 | matrix: ${{ steps.set-matrix.outputs.matrix }} 41 | 42 | steps: 43 | - uses: actions/checkout@v6 44 | with: 45 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 46 | fetch-depth: 0 47 | 48 | - name: Set up Node.js 49 | uses: actions/setup-node@v6 50 | with: 51 | node-version-file: .github/actions/version-matrix/package.json 52 | cache: yarn 53 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 54 | 55 | - run: yarn 56 | working-directory: ./.github/actions/version-matrix 57 | 58 | - name: Generate matrix 59 | id: set-matrix 60 | run: echo "matrix=$(yarn node:puppeteer)" >> $GITHUB_OUTPUT 61 | working-directory: ./.github/actions/version-matrix 62 | 63 | - name: Print matrix 64 | run: | 65 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "node-version=\(.["node-version"]) apify-version=\(.["apify-version"]) crawlee-version=\(.["crawlee-version"]) puppeteer-version=\(.["puppeteer-version"]) is-latest=\(.["is-latest"])"' 66 | echo "" 67 | echo "Raw matrix:" 68 | echo "" 69 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 70 | 71 | - name: Push updated matrix 72 | if: github.event_name != 'pull_request' 73 | run: | 74 | # Setup git user 75 | git config --global user.email "noreply@apify.com" 76 | git config --global user.name "Apify CI Bot" 77 | git config pull.rebase true 78 | 79 | # Add and commit if there are changes 80 | git add ./.github/actions/version-matrix/data/*.json 81 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} node:puppeteer-chrome cache" 82 | 83 | # Try to push 5 times, with pulls between retries 84 | for i in {1..5}; do 85 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 86 | done 87 | 88 | # Build master images that are not dependent on existing builds. 89 | build-main: 90 | needs: [matrix] 91 | 92 | runs-on: ubuntu-latest 93 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 94 | 95 | strategy: 96 | # By the time some build fails, other build can be already finished 97 | # so fail-fast does not really prevent the publishing of all parallel builds 98 | fail-fast: false 99 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 100 | 101 | name: "node: ${{ matrix.node-version }}, apify: ${{ matrix.apify-version }}, crawlee: ${{ matrix.crawlee-version }}, pptr: ${{ matrix.puppeteer-version }}, is-latest: ${{ matrix.is-latest }}" 102 | 103 | steps: 104 | - name: Set default inputs if event is pull request 105 | if: github.event_name == 'pull_request' 106 | run: | 107 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 108 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 109 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 110 | 111 | - name: Set default inputs if event is schedule 112 | if: github.event_name == 'schedule' 113 | run: | 114 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 115 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 116 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 117 | 118 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 119 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 120 | run: | 121 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 122 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 123 | 124 | - name: Check if inputs are set correctly 125 | run: | 126 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 127 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 128 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION input is empty!" >&2; exit 1; fi 129 | 130 | - name: Checkout 131 | uses: actions/checkout@v6 132 | 133 | - name: Set up Node ${{ matrix.node-version }} 134 | uses: actions/setup-node@v6 135 | with: 136 | node-version: ${{ matrix.node-version }} 137 | 138 | - name: Set Dependency Versions 139 | run: | 140 | cd ${{ matrix.image-name }} 141 | node ../.github/scripts/set-dependency-versions.js 142 | env: 143 | PUPPETEER_VERSION: ${{ matrix.puppeteer-version }} 144 | 145 | - # It seems that it takes at least two minutes before a newly published version 146 | # becomes available in the NPM registry. We wait before starting the image builds. 147 | name: Wait For Package Registry 148 | uses: nick-fields/retry@v3 149 | with: 150 | timeout_minutes: 2 # timeout for a single attempt 151 | max_attempts: 5 152 | retry_wait_seconds: 60 # wait between retries 153 | command: cd ${{ matrix.image-name }} && npm i --dry-run 154 | 155 | - name: Prepare image tags 156 | id: prepare-tags 157 | uses: actions/github-script@v8 158 | env: 159 | CURRENT_NODE: ${{ matrix.node-version }} 160 | LATEST_NODE: ${{ matrix.latest-node-version }} 161 | FRAMEWORK_VERSION: ${{ matrix.puppeteer-version }} 162 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 163 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 164 | IS_LATEST_BROWSER_IMAGE: ${{ matrix.is-latest }} 165 | with: 166 | script: | 167 | const generateTags = require("./.github/scripts/prepare-node-image-tags.js"); 168 | return generateTags(); 169 | 170 | - name: Set up QEMU 171 | uses: docker/setup-qemu-action@v3 172 | 173 | - name: Set up Docker Buildx 174 | uses: docker/setup-buildx-action@v3 175 | 176 | - name: Build and tag image 177 | uses: docker/build-push-action@v6 178 | with: 179 | context: ./${{ matrix.image-name }} 180 | file: ./${{ matrix.image-name }}/Dockerfile 181 | build-args: NODE_VERSION=${{ matrix.node-version }} 182 | load: true 183 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 184 | 185 | - name: Test image 186 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 187 | 188 | - name: Login to DockerHub 189 | if: github.event_name != 'pull_request' 190 | uses: docker/login-action@v3 191 | with: 192 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 193 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 194 | 195 | - name: Push images 196 | if: github.event_name != 'pull_request' 197 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 198 | -------------------------------------------------------------------------------- /.github/workflows/release-node-playwright.yaml: -------------------------------------------------------------------------------- 1 | name: Node + Playwright images 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release_tag: 7 | description: "Tag for the images (e.g.: beta)" 8 | required: true 9 | apify_version: 10 | description: "Apify SDK version (e.g.: ^1.0.0). If missing, the latest version will be used." 11 | required: false 12 | crawlee_version: 13 | description: "Crawlee version (e.g.: ^1.0.0). If missing, the latest version will be used." 14 | required: false 15 | rebuild_images: 16 | description: "Rebuilds images even if the cache state matches the current state." 17 | required: false 18 | type: boolean 19 | 20 | repository_dispatch: 21 | types: 22 | - build-node-images 23 | 24 | pull_request: 25 | 26 | schedule: 27 | - cron: 0 */2 * * * 28 | 29 | env: 30 | RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.client_payload.release_tag }} 31 | APIFY_VERSION: ${{ github.event.inputs.apify_version || github.event.client_payload.apify_version }} 32 | CRAWLEE_VERSION: ${{ github.event.inputs.crawlee_version || github.event.client_payload.crawlee_version }} 33 | SHOULD_USE_LAST_FIVE: ${{ github.event_name != 'pull_request' }} 34 | SKIP_CACHE_CHECK: ${{ github.event_name == 'pull_request' || github.event.inputs.rebuild_images == 'true' }} 35 | 36 | jobs: 37 | matrix: 38 | runs-on: ubuntu-latest 39 | outputs: 40 | matrix: ${{ steps.set-matrix.outputs.matrix }} 41 | 42 | steps: 43 | - uses: actions/checkout@v6 44 | with: 45 | token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} 46 | fetch-depth: 0 47 | 48 | - name: Set up Node.js 49 | uses: actions/setup-node@v6 50 | with: 51 | node-version-file: .github/actions/version-matrix/package.json 52 | cache: yarn 53 | cache-dependency-path: .github/actions/version-matrix/yarn.lock 54 | 55 | - run: yarn 56 | working-directory: ./.github/actions/version-matrix 57 | 58 | - name: Generate matrix 59 | id: set-matrix 60 | run: echo "matrix=$(yarn node:playwright)" >> $GITHUB_OUTPUT 61 | working-directory: ./.github/actions/version-matrix 62 | 63 | - name: Print matrix 64 | run: | 65 | echo "Matrix:" 66 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -r '.include[] | "node-version=\(.["node-version"]) apify-version=\(.["apify-version"]) crawlee-version=\(.["crawlee-version"]) playwright-version=\(.["playwright-version"]) camoufox-version=\(.["camoufox-version"]) is-latest=\(.["is-latest"]) image-name=\(.["image-name"])"' 67 | echo "" 68 | echo "Raw matrix:" 69 | echo "" 70 | echo '${{ steps.set-matrix.outputs.matrix }}' | jq -e 71 | 72 | - name: Push updated matrix 73 | if: github.event_name != 'pull_request' 74 | run: | 75 | # Setup git user 76 | git config --global user.email "noreply@apify.com" 77 | git config --global user.name "Apify CI Bot" 78 | git config pull.rebase true 79 | 80 | # Add and commit if there are changes 81 | git add ./.github/actions/version-matrix/data/*.json 82 | git diff-index --quiet HEAD || git commit -m "chore(docker): update ${{ env.RELEASE_TAG || 'latest' }} node:playwright cache" 83 | 84 | # Try to push 5 times, with pulls between retries 85 | for i in {1..5}; do 86 | git push && break || echo "Failed to push, retrying in 5 seconds..." && sleep 5 && git pull 87 | done 88 | 89 | # Build master images that are not dependent on existing builds. 90 | build-main: 91 | needs: [matrix] 92 | 93 | runs-on: ubuntu-latest 94 | if: ${{ toJson(fromJson(needs.matrix.outputs.matrix).include) != '[]' }} 95 | 96 | strategy: 97 | # By the time some build fails, other build can be already finished 98 | # so fail-fast does not really prevent the publishing of all parallel builds 99 | fail-fast: false 100 | matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} 101 | 102 | name: "img: ${{ matrix.image-name }} node: ${{ matrix.node-version }}, apify: ${{ matrix.apify-version }}, crawlee: ${{ matrix.crawlee-version }}, pw: ${{ matrix.playwright-version }}, cf: ${{ matrix.camoufox-version }}, is-latest: ${{ matrix.is-latest }}" 103 | 104 | steps: 105 | - name: Set default inputs if event is pull request 106 | if: github.event_name == 'pull_request' 107 | run: | 108 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=CI_TEST" >> $GITHUB_ENV; fi 109 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 110 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 111 | 112 | - name: Set default inputs if event is schedule 113 | if: github.event_name == 'schedule' 114 | run: | 115 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG=latest" >> $GITHUB_ENV; fi 116 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 117 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 118 | 119 | - name: Set default inputs if event is workflow_dispatch or repository_dispatch 120 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' 121 | run: | 122 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION=${{ matrix.apify-version }}" >> $GITHUB_ENV; fi 123 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION=${{ matrix.crawlee-version }}" >> $GITHUB_ENV; fi 124 | 125 | - name: Check if inputs are set correctly 126 | run: | 127 | if [[ -z "$RELEASE_TAG" ]]; then echo "RELEASE_TAG input is empty!" >&2; exit 1; fi 128 | if [[ -z "$APIFY_VERSION" ]]; then echo "APIFY_VERSION input is empty!" >&2; exit 1; fi 129 | if [[ -z "$CRAWLEE_VERSION" ]]; then echo "CRAWLEE_VERSION input is empty!" >&2; exit 1; fi 130 | 131 | - name: Checkout 132 | uses: actions/checkout@v6 133 | 134 | - name: Set up Node ${{ matrix.node-version }} 135 | uses: actions/setup-node@v6 136 | with: 137 | node-version: ${{ matrix.node-version }} 138 | 139 | - name: Set Dependency Versions 140 | run: | 141 | cd ${{ matrix.image-name }} 142 | node ../.github/scripts/set-dependency-versions.js 143 | env: 144 | PLAYWRIGHT_VERSION: ${{ matrix.playwright-version }} 145 | CAMOUFOX_VERSION: ${{ matrix.camoufox-version }} 146 | 147 | - # It seems that it takes at least two minutes before a newly published version 148 | # becomes available in the NPM registry. We wait before starting the image builds. 149 | name: Wait For Package Registry 150 | uses: nick-fields/retry@v3 151 | with: 152 | timeout_minutes: 2 # timeout for a single attempt 153 | max_attempts: 5 154 | retry_wait_seconds: 60 # wait between retries 155 | command: cd ${{ matrix.image-name }} && npm i --dry-run 156 | 157 | - name: Prepare image tags 158 | id: prepare-tags 159 | uses: actions/github-script@v8 160 | env: 161 | CURRENT_NODE: ${{ matrix.node-version }} 162 | LATEST_NODE: ${{ matrix.latest-node-version }} 163 | FRAMEWORK_VERSION: ${{ matrix.playwright-version }} 164 | RELEASE_TAG: ${{ env.RELEASE_TAG }} 165 | IMAGE_NAME: apify/actor-${{ matrix.image-name }} 166 | IS_LATEST_BROWSER_IMAGE: ${{ matrix.is-latest }} 167 | with: 168 | script: | 169 | const generateTags = require("./.github/scripts/prepare-node-image-tags.js"); 170 | return generateTags(); 171 | 172 | - name: Set up QEMU 173 | uses: docker/setup-qemu-action@v3 174 | 175 | - name: Set up Docker Buildx 176 | uses: docker/setup-buildx-action@v3 177 | 178 | - name: Build and tag image 179 | uses: docker/build-push-action@v6 180 | with: 181 | context: ./${{ matrix.image-name }} 182 | file: ./${{ matrix.image-name }}/Dockerfile 183 | # PLAYWRIGHT_VERSION here is used for the full node-playwright image 184 | build-args: | 185 | NODE_VERSION=${{ matrix.node-version }} 186 | PLAYWRIGHT_VERSION=${{ format('v{0}-', matrix.playwright-version) }} 187 | load: true 188 | tags: ${{ fromJson(steps.prepare-tags.outputs.result).allTags }} 189 | 190 | - name: Test image 191 | run: docker run ${{ fromJson(steps.prepare-tags.outputs.result).firstImageName }} 192 | 193 | - name: Login to DockerHub 194 | if: github.event_name != 'pull_request' 195 | uses: docker/login-action@v3 196 | with: 197 | username: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_USERNAME }} 198 | password: ${{ secrets.APIFY_SERVICE_ACCOUNT_DOCKERHUB_TOKEN }} 199 | 200 | - name: Push images 201 | if: github.event_name != 'pull_request' 202 | run: docker push apify/actor-${{ matrix.image-name }} --all-tags 203 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Environment values 2 | # Node 3 | NODE_VERSION ?= 20 4 | # Tag must have format: v1.42.0- 5 | PLAYWRIGHT_VERSION ?= v1.50.0- 6 | CAMOUFOX_VERSION ?= 0.3.5 7 | # Tag must have format: 22.6.2 8 | PUPPETEER_VERSION ?= 22.6.2 9 | PKG_JSON_PW_VERSION = $(subst v,,$(subst -,,$(PLAYWRIGHT_VERSION))) 10 | 11 | # Python 12 | PYTHON_VERSION ?= 3.14 13 | # Apify latest version (python does not support the 'latest' tag) 14 | PYTHON_APIFY_VERSION ?= 1.7.0 15 | PYTHON_PLAYWRIGHT_VERSION = $(subst v,,$(subst -,,$(PLAYWRIGHT_VERSION))) 16 | PYTHON_SELENIUM_VERSION ?= 4.14.0 17 | 18 | ALL_TESTS = test-node test-playwright test-playwright-chrome test-playwright-firefox test-playwright-webkit test-puppeteer-chrome test-python test-python-playwright test-python-selenium test-playwright-camoufox 19 | ALL_NODE_TESTS = test-node test-playwright test-playwright-chrome test-playwright-firefox test-playwright-webkit test-puppeteer-chrome test-playwright-camoufox 20 | ALL_PYTHON_TESTS = test-python test-python-playwright test-python-selenium 21 | 22 | what-tests: 23 | @echo "Available tests:" 24 | @for test in $(ALL_TESTS); do \ 25 | echo " $$test"; \ 26 | done 27 | 28 | all: 29 | @echo "Running all tests, this will take a while..." 30 | 31 | @for test in $(ALL_TESTS); do \ 32 | echo "Running $$test"; \ 33 | $(MAKE) $$test; \ 34 | echo "Done $$test"; \ 35 | done 36 | 37 | @echo "" 38 | @echo "All tests done!" 39 | 40 | all-node: 41 | @echo "Running all node tests, this will take a while..." 42 | 43 | @for test in $(ALL_NODE_TESTS); do \ 44 | echo "Running $$test"; \ 45 | $(MAKE) $$test; \ 46 | echo "Done $$test"; \ 47 | done 48 | 49 | @echo "" 50 | @echo "All node tests done!" 51 | 52 | all-python: 53 | @echo "Running all python tests, this will take a while..." 54 | 55 | @for test in $(ALL_PYTHON_TESTS); do \ 56 | echo "Running $$test"; \ 57 | $(MAKE) $$test; \ 58 | echo "Done $$test"; \ 59 | done 60 | 61 | @echo "" 62 | @echo "All python tests done!" 63 | 64 | test-node: 65 | @echo "Building node with version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 66 | 67 | @# Correct package.json 68 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest node ./scripts/update-package-json.mjs ./node 69 | 70 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node/Dockerfile -t apify/node:local --load ./node 71 | docker run --rm -it --platform linux/amd64 apify/node:local 72 | 73 | @# Restore package.json 74 | @git checkout ./node/package.json 1>/dev/null 2>&1 75 | 76 | @# Delete docker image 77 | docker rmi apify/node:local 78 | 79 | test-playwright: 80 | @echo "Building playwright with version $(PLAYWRIGHT_VERSION) (overwrite using PLAYWRIGHT_VERSION=v1.42.0-) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 81 | 82 | @# Correct package.json 83 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PLAYWRIGHT_VERSION=$(PKG_JSON_PW_VERSION) node ./scripts/update-package-json.mjs ./node-playwright 84 | 85 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --build-arg PLAYWRIGHT_VERSION=$(PLAYWRIGHT_VERSION) --file ./node-playwright/Dockerfile --tag apify/playwright:local --load ./node-playwright 86 | docker run --rm -it --platform linux/amd64 apify/playwright:local 87 | 88 | @# Restore package.json 89 | @git checkout ./node-playwright/package.json 1>/dev/null 2>&1 90 | 91 | @# Delete docker image 92 | docker rmi apify/playwright:local 93 | 94 | test-playwright-chrome: 95 | @echo "Building playwright-chrome with version $(PLAYWRIGHT_VERSION) (overwrite using PLAYWRIGHT_VERSION=v1.42.0-) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 96 | 97 | @# Correct package.json 98 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PLAYWRIGHT_VERSION=$(PKG_JSON_PW_VERSION) node ./scripts/update-package-json.mjs ./node-playwright-chrome 99 | 100 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node-playwright-chrome/Dockerfile --tag apify/playwright-chrome:local --load ./node-playwright-chrome 101 | docker run --rm -it --platform linux/amd64 apify/playwright-chrome:local 102 | 103 | @# Restore package.json 104 | @git checkout ./node-playwright-chrome/package.json 1>/dev/null 2>&1 105 | 106 | @# Delete docker image 107 | docker rmi apify/playwright-chrome:local 108 | 109 | 110 | test-playwright-firefox: 111 | @echo "Building playwright-firefox with version $(PLAYWRIGHT_VERSION) (overwrite using PLAYWRIGHT_VERSION=v1.42.0-) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 112 | 113 | @# Correct package.json 114 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PLAYWRIGHT_VERSION=$(PKG_JSON_PW_VERSION) node ./scripts/update-package-json.mjs ./node-playwright-firefox 115 | 116 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node-playwright-firefox/Dockerfile --tag apify/playwright-firefox:local --load ./node-playwright-firefox 117 | docker run --rm -it --platform linux/amd64 apify/playwright-firefox:local 118 | 119 | @# Restore package.json 120 | @git checkout ./node-playwright-firefox/package.json 1>/dev/null 2>&1 121 | 122 | @# Delete docker image 123 | docker rmi apify/playwright-firefox:local 124 | 125 | test-playwright-camoufox: 126 | @echo "Building playwright-camoufox with version $(PLAYWRIGHT_VERSION) (overwrite using PLAYWRIGHT_VERSION=v1.42.0-), Camoufox $(CAMOUFOX_VERSION) (overwrite using CAMOUFOX_VERSION=0.3.5) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 127 | 128 | @# Correct package.json 129 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PLAYWRIGHT_VERSION=$(PKG_JSON_PW_VERSION) CAMOUFOX_VERSION=$(CAMOUFOX_VERSION) node ./scripts/update-package-json.mjs ./node-playwright-camoufox 130 | 131 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node-playwright-camoufox/Dockerfile --tag apify/playwright-camoufox:local --load ./node-playwright-camoufox 132 | docker run --rm -it --platform linux/amd64 apify/playwright-camoufox:local 133 | 134 | @# Restore package.json 135 | @git checkout ./node-playwright-camoufox/package.json 1>/dev/null 2>&1 136 | 137 | @# Delete docker image 138 | docker rmi apify/playwright-camoufox:local 139 | 140 | test-playwright-webkit: 141 | @echo "Building playwright-webkit with version $(PLAYWRIGHT_VERSION) (overwrite using PLAYWRIGHT_VERSION=v1.42.0-) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 142 | 143 | @# Correct package.json 144 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PLAYWRIGHT_VERSION=$(PKG_JSON_PW_VERSION) node ./scripts/update-package-json.mjs ./node-playwright-webkit 145 | 146 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node-playwright-webkit/Dockerfile --tag apify/playwright-webkit:local --load ./node-playwright-webkit 147 | docker run --rm -it --platform linux/amd64 apify/playwright-webkit:local 148 | 149 | @# Restore package.json 150 | @git checkout ./node-playwright-webkit/package.json 1>/dev/null 2>&1 151 | 152 | @# Delete docker image 153 | docker rmi apify/playwright-webkit:local 154 | 155 | test-puppeteer-chrome: 156 | @echo "Building puppeteer-chrome with version $(PUPPETEER_VERSION) (overwrite using PUPPETEER_VERSION=22.6.2) and node version $(NODE_VERSION) (overwrite using NODE_VERSION=XX)" 157 | 158 | @# Correct package.json 159 | @APIFY_VERSION=latest CRAWLEE_VERSION=latest PUPPETEER_VERSION=$(PUPPETEER_VERSION) node ./scripts/update-package-json.mjs ./node-puppeteer-chrome 160 | 161 | docker buildx build --platform linux/amd64 --build-arg NODE_VERSION=$(NODE_VERSION) --file ./node-puppeteer-chrome/Dockerfile --tag apify/puppeteer-chrome:local --load ./node-puppeteer-chrome 162 | docker run --rm -it --platform linux/amd64 apify/puppeteer-chrome:local 163 | 164 | @# Restore package.json 165 | @git checkout ./node-puppeteer-chrome/package.json 1>/dev/null 2>&1 166 | 167 | @# Delete docker image 168 | docker rmi apify/puppeteer-chrome:local 169 | 170 | test-python: 171 | @echo "Building python with version $(PYTHON_VERSION) (overwrite using PYTHON_VERSION=XX)" 172 | 173 | docker buildx build --platform linux/amd64 --build-arg PYTHON_VERSION=$(PYTHON_VERSION) --build-arg APIFY_VERSION=$(PYTHON_APIFY_VERSION) --file ./python/Dockerfile --tag apify/python:local --load ./python 174 | docker run --rm -it --platform linux/amd64 apify/python:local 175 | 176 | @# Delete docker image 177 | docker rmi apify/python:local 178 | 179 | test-python-playwright: 180 | @echo "Building python-playwright with version $(PYTHON_VERSION) (overwrite using PYTHON_VERSION=XX)" 181 | 182 | docker buildx build --platform linux/amd64 --build-arg PYTHON_VERSION=$(PYTHON_VERSION) --build-arg APIFY_VERSION=$(PYTHON_APIFY_VERSION) --build-arg PLAYWRIGHT_VERSION=$(PYTHON_PLAYWRIGHT_VERSION) --file ./python-playwright/Dockerfile --tag apify/python-playwright:local --load ./python-playwright 183 | docker run --rm -it --platform linux/amd64 apify/python-playwright:local 184 | 185 | @# Delete docker image 186 | docker rmi apify/python-playwright:local 187 | 188 | test-python-selenium: 189 | @echo "Building python-selenium with version $(PYTHON_VERSION) (overwrite using PYTHON_VERSION=XX)" 190 | 191 | docker buildx build --platform linux/amd64 --build-arg PYTHON_VERSION=$(PYTHON_VERSION) --build-arg APIFY_VERSION=$(PYTHON_APIFY_VERSION) --build-arg SELENIUM_VERSION=$(PYTHON_SELENIUM_VERSION) --file ./python-selenium/Dockerfile --tag apify/python-selenium:local --load ./python-selenium 192 | docker run --rm -it --platform linux/amd64 apify/python-selenium:local 193 | 194 | @# Delete docker image 195 | docker rmi apify/python-selenium:local 196 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017 Apify Technologies s.r.o. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. --------------------------------------------------------------------------------