Sign inSign up

cr8ns/node-runner

By cr8ns

•Updated 12 months ago

Image
0

803

cr8ns/node-runner repository overview

⁠Docker Runner

A Docker-based CI/CD runner for Node.js projects that automatically clones repositories and executes package manager commands.

⁠Features

  • Automatic git repository cloning and updating
  • Support for multiple package managers: npm, yarn, pnpm, bun
  • Persistent source directory with volume mounting
  • Automatic dependency installation
  • Shallow git clones for faster operations

⁠Environment Variables

⁠Required
  • COMMAND - Commands to execute (use && to chain multiple commands)
  • GIT_REPO - Git repository URL (e.g., https://github.com/user/repo.git)
⁠Optional
  • PACKAGE_MANAGER - Package manager to use (default: npm)
    • Supported: npm, yarn, pnpm, bun
  • GIT_BRANCH - Git branch to checkout (default: main)
  • GIT_USERNAME - Git username for private repositories
  • GIT_ACCESS_TOKEN - Git access token for private repositories
  • GIT_DEPTH - Git clone depth (default: 1, use full for complete history)
  • GIT_SKIP_UPDATE - Skip git pull on existing repo (default: false, set to true to skip)
  • GIT_WATCH - Enable watch mode to auto-restart on git push (default: disabled)
    • Set to true or any non-empty value to enable (default interval: 60 seconds)
    • Set to a number to specify custom check interval in seconds (e.g., 30, 120)
    • Set to false or leave empty to disable
  • WORK_DIR - Working directory inside container (default: /source)
  • EXTRA_PACKAGES - Additional apt packages to install (e.g., sqlite3 python3-pip)

⁠Package Managers

All package managers automatically run install if node_modules doesn't exist:

  • npm - npm install && npm run
  • yarn - yarn install && yarn run
  • pnpm - pnpm install && pnpm run
  • bun - bun install && bun

⁠How It Works

  1. Container starts and navigates to WORK_DIR
  2. clone-repo.sh clones or updates the repository
  3. run-command.sh installs dependencies if needed
  4. Commands are executed in sequence
  5. If GIT_WATCH is enabled, monitors for changes and restarts on git push

⁠Notes

  • Source directory is persisted via volume mount
  • Subsequent runs update the repository instead of re-cloning
  • Untracked files (like .env) are preserved between runs
  • Shallow clones (depth 1) are used by default for speed
  • Use specific Dockerfiles to reduce image size

Tag summary

Content type

Image

Digest

sha256:8529221a0…

Size

254 MB

Last updated

12 months ago

docker pull cr8ns/node-runner