Git Product home page Git Product logo

acr-builder's Introduction

ACR builder

Linux Build Windows Build Go Report
Build Status Build Status Go Report Card

ACR Builder is the backbone behind Azure Container Registry Tasks.

It can be used to automate container image patching and execute arbitrary containers for complex workflows.

You can find examples of how to create multi-step tasks here.

Task Schema

For a list of all available YAML properties, please review the Task schema.

Templating

To understand templating and how to provide custom values to your runs, review templates.

Requirements

  • Docker

Building

With Docker, execute the following commands from the root of the repository.

Linux:

$ docker build -f Dockerfile -t acb .

Windows:

$ docker build -f Windows.Dockerfile -t acb .

Usage

$ acb --help

NAME:
   acb - run and build containers on Azure Container Registry

USAGE:
   acb [global options] command [command options] [arguments...]

VERSION:
   38f06e5

COMMANDS:
     build      build container images
     download   download the specified context to a destination folder
     exec       execute a task file
     render     render the specified template
     scan       scan a Dockerfile for dependencies
     version    print the client and runtime versions
     getsecret  gets the secret value from a specified vault
     help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Building an image

See acb build --help for a list of all parameters.

$ docker run -v /var/run/docker.sock:/var/run/docker.sock acb build https://github.com/Azure/acr-builder.git

Running a task

See acb exec --help for a list of all parameters.

$ docker run -v $(pwd):/workspace --workdir /workspace -v /var/run/docker.sock:/var/run/docker.sock acb exec --homevol $(pwd) -f templating/testdata/helloworld/git-build.yaml --values templating/testdata/helloworld/values.yaml --id demo -r foo.azurecr.io

Rendering a template locally

$ acb render -f acb.yaml --values values.yaml

If your template uses .Run.ID or other .Run variables, refer to the full list of parameters using acb render --help.

F5 experience on VSCode

You can install delve, and add something like this to your .vscode/launch.json file - and hit f5. The binary executes from under ./cmd/acb, so you can put any Task files that you want to debug.

First, you'd have to run a few commands:

Create a source volume for your workspace (i.e. your context, Dockerfiles, Task yaml files)

sudo docker volume create source
sudo docker volume inspect source
[
    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/source/_data",
        "Name": "source",
        "Options": {},
        "Scope": "local"
    }
]
sudo rm -rf /var/lib/docker/volumes/source/_data
sudo ln -s $(pwd) /var/lib/docker/volumes/source/_data

Now, you can add your Dockerfiles or Task files to cmd/acb/ folder.

If your testing Task file contains pulling/pushing stuff off a private repository, then you will have to do the following step. Make sure you are logged in to the repo using docker login. If you don't need that, you can skip the following step.

Create a home volume for Docker to find your registry credentials.

From the cmd/acb/ folder run

sudo docker volume create home
sudo docker volume inspect home
[
    {
        "CreatedAt": "0001-01-01T00:00:00Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/home/_data",
        "Name": "home",
        "Options": {},
        "Scope": "local"
    }
]
sudo rm -rf /var/lib/docker/volumes/home/_data
sudo ln -s $(HOME)/.docker /var/lib/docker/volumes/home/_data

Create launch.json file in your .vscode folder:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceRoot}/cmd/acb",
            "env": {},
            "args": [
               "exec",
               "--homevol",
               "source",
               "-f",
               "./test.acb.yml",
               ".",
                "--id",
                "blah",
                "--registry",
                "samashah.azurecr.io"
            ]
        }
    ]
}

Press F5.

acr-builder's People

Contributors

akashsinghal avatar dependabot-preview[bot] avatar djyou avatar ehotinger avatar ggonzalere avatar inorthtyphoon avatar jaysterp avatar jinhuafei avatar karthikraobr avatar microsoftopensource avatar mnltejaswini avatar msftgits avatar northtyphoon avatar sajayantony avatar shahzzzam avatar xiadu94 avatar xyxyxyxyxyxy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.