- Shell 89.1%
- Dockerfile 10.9%
| scripts | ||
| .gitlab-ci.yml | ||
| Dockerfile | ||
| Dockerfile.bun | ||
| Dockerfile.npm | ||
| Dockerfile.pnpm | ||
| Dockerfile.yarn | ||
| entrypoint.sh | ||
| README.md | ||
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
- Supported:
GIT_BRANCH- Git branch to checkout (default:main)GIT_USERNAME- Git username for private repositoriesGIT_ACCESS_TOKEN- Git access token for private repositoriesGIT_DEPTH- Git clone depth (default:1, usefullfor complete history)GIT_SKIP_UPDATE- Skip git pull on existing repo (default:false, set totrueto skip)GIT_WATCH- Enable watch mode to auto-restart on git push (default: disabled)- Set to
trueor 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
falseor leave empty to disable
- Set to
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 runyarn- yarn install && yarn runpnpm- pnpm install && pnpm runbun- bun install && bun
How It Works
- Container starts and navigates to
WORK_DIR clone-repo.shclones or updates the repositoryrun-command.shinstalls dependencies if needed- Commands are executed in sequence
- If
GIT_WATCHis 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