42 lines
1.4 KiB
Ruby
42 lines
1.4 KiB
Ruby
class DockerBuildx < Formula
|
|
desc "Docker CLI plugin for extended build capabilities with BuildKit"
|
|
homepage "https://docs.docker.com/buildx/working-with-buildx/"
|
|
url "https://github.com/docker/buildx/archive/refs/tags/v0.14.0.tar.gz"
|
|
sha256 "9ed27d47b728288500ba2535366792d9b006354e02178688360919663f92b63e"
|
|
license "Apache-2.0"
|
|
head "https://github.com/docker/buildx.git", branch: "master"
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ldflags = %W[
|
|
-s -w
|
|
-X github.com/docker/buildx/version.Version=v#{version}
|
|
-X github.com/docker/buildx/version.Revision=#{tap.user}
|
|
]
|
|
|
|
system "go", "build", *std_go_args(ldflags:), "./cmd/buildx"
|
|
|
|
(lib/"docker/cli-plugins").install_symlink bin/"docker-buildx"
|
|
|
|
doc.install Dir["docs/reference/*.md"]
|
|
|
|
generate_completions_from_executable(bin/"docker-buildx", "completion")
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
docker-buildx is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
|
|
"cliPluginsExtraDirs": [
|
|
"#{HOMEBREW_PREFIX}/lib/docker/cli-plugins"
|
|
]
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match "github.com/docker/buildx v#{version}", shell_output("#{bin}/docker-buildx version")
|
|
output = shell_output(bin/"docker-buildx build . 2>&1", 1)
|
|
assert_match(/(denied while trying to|Cannot) connect to the Docker daemon/, output)
|
|
end
|
|
end
|