YAML for Custom Build
Execute shell commands in a Docker container. The most common action type for building, testing, and deploying applications.
YAML examples for Custom Build
Build with Docker services and caching
yaml- action: "Build application" type: "BUILD" trigger_time: ON_EVERY_EXECUTION working_directory: "/buddy/my-repo-dir" docker_image_name: "library/ubuntu" docker_image_tag: "$tag" execute_commands: - "ls -al > ls.log" setup_commands: - "apt-get update -y" - "apt-get install -y wget" main_service_name: "my-app.svc" services: - type: "MYSQL" version: "5.7" - type: "MONGO_DB" version: "3.2.4" cached_dirs: - "/build/test" - "/bin/Debug" shell: "SH" cache_base_image: true variables: - key: "tag" value: "latest"
Minimal build with npm
yaml- action: "Execute: npm test" type: "BUILD" docker_image_name: "library/node" docker_image_tag: "6" execute_commands: - "npm install" - "npm test"
Build with private Docker registry
yaml- action: "Build application" type: "BUILD" docker_image_name: "buddyworks/private_image" docker_image_tag: "latest" image_location: "PRIVATE_REGISTRY" docker_registry: "DOCKER_HUB" execute_commands: - "ls -al > ls.log" integration: "my_integration"
Build with volume mappings
yaml- action: "Build Android app" type: "BUILD" working_directory: "/buddy/yaml-project" docker_image_name: "library/openjdk" docker_image_tag: "8" execute_commands: - "chmod +x gradlew" - "./gradlew assembleRelease" volume_mappings: - "/:/buddy/mount/directory"
Using image from Google Container Registry
yaml- action: "Build application" type: "BUILD" docker_image_name: "tokyo-house-147623/private_image" docker_image_tag: "latest" image_location: "PRIVATE_REGISTRY" docker_registry: "GOOGLE_GCR" execute_commands: - "ls -al > ls.log" registry: "my.gcr.com" integration: "my_integration"
Using image from Amazon ECR
yaml- action: "Build application" type: "BUILD" docker_image_name: "private_image" docker_image_tag: "latest" image_location: "PRIVATE_REGISTRY" docker_registry: "AMAZON_ECR" execute_commands: - "ls -al > ls.log" region: "us-east-1" integration: "my_integration"
Using image from GitHub Container Registry
yaml- action: "Build application" type: "BUILD" docker_image_name: "private_image" docker_image_tag: "latest" image_location: "PRIVATE_REGISTRY" docker_registry: "GIT_HUB_CONTAINER_REGISTRY" execute_commands: - "ls -al > ls.log" integration: "my_integration"
Using image built in previous action
yaml- action: "Build application" type: "BUILD" docker_image_name: "library/ubuntu" docker_build_action_name: "Build Docker image" image_location: "ACTION" execute_commands: - "ls -al > ls.log"
Using image from artifact registry
yaml- action: "Build with artifact registry" type: "BUILD" docker_image_name: "ubuntu" docker_image_tag: "22.04" image_location: "ARTIFACT_REGISTRY" artifact: "my-docker-image" version: "latest" execute_commands: - echo "Hello"