Set the working directory and user for the template:
// Set working directorytemplate.setWorkdir("/app");// Set user (runs subsequent commands as this user)template.setUser('node')template.setUser("1000:1000"); // User ID and group ID
Clone Git repositories during template build (requires git to be installed):
// Clone a repositorytemplate.gitClone('https://github.com/user/repo.git')// Clone a repository to a specific pathtemplate.gitClone('https://github.com/user/repo.git', '/app/repo')// Clone a specific branchtemplate.gitClone('https://github.com/user/repo.git', '/app/repo', { branch: 'main',})// Shallow clone with depth limittemplate.gitClone('https://github.com/user/repo.git', '/app/repo', { depth: 1,})
// Run a single commandtemplate.runCmd('apt-get update && apt-get install -y curl')// Run multiple commandstemplate.runCmd(['apt-get update', 'apt-get install -y curl', 'curl --version'])// Run commands as a specific usertemplate.runCmd('npm install', { user: 'node' })