From e3af8f57ab8d5073ee4f001cffde59a0a4ab70e7 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 18 Jul 2017 13:29:52 -0700 Subject: [PATCH] examples: make buildkit3 use readonly where possible Signed-off-by: Tonis Tiigi --- examples/buildkit3/buildkit.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/buildkit3/buildkit.go b/examples/buildkit3/buildkit.go index 4a4d4362..c59c19f6 100644 --- a/examples/buildkit3/buildkit.go +++ b/examples/buildkit3/buildkit.go @@ -45,15 +45,15 @@ func goRepo(s *llb.State, repo string, src *llb.State) func(ro ...llb.RunOption) dir := "/go/src/" + repo return func(ro ...llb.RunOption) *llb.State { es := s.Dir(dir).Run(ro...) - es.AddMount(dir, src) - return es.AddMount(dir+"/bin", llb.Scratch()) + es.AddMount(dir, src, llb.Readonly) + return es.AddMount("/out", llb.Scratch()) } } func runc(version string) *llb.State { repo := "github.com/opencontainers/runc" return goRepo(goBuildBase(), repo, llb.Git(repo, version))( - llb.Shlex("go build -o ./bin/runc ./"), + llb.Shlex("go build -o /out/runc ./"), ) } @@ -63,7 +63,7 @@ func containerd(version string) *llb.State { goBuildBase(). Run(llb.Shlex("apk add --no-cache btrfs-progs-dev")).Root(), repo, llb.Git(repo, version, llb.KeepGitDir()))( - llb.Shlex("make bin/containerd"), + llb.Shlex("go build -o /out/containerd ./cmd/containerd"), ) } @@ -75,11 +75,11 @@ func buildkit(opt buildOpt) *llb.State { } run := goRepo(goBuildBase(), repo, src) - builddStandalone := run(llb.Shlex("go build -o ./bin/buildd-standalone -tags standalone ./cmd/buildd")) + builddStandalone := run(llb.Shlex("go build -o /out/buildd-standalone -tags standalone ./cmd/buildd")) - builddContainerd := run(llb.Shlex("go build -o ./bin/buildd-containerd -tags containerd ./cmd/buildd")) + builddContainerd := run(llb.Shlex("go build -o /out/buildd-containerd -tags containerd ./cmd/buildd")) - buildctl := run(llb.Shlex("go build -o ./bin/buildctl ./cmd/buildctl")) + buildctl := run(llb.Shlex("go build -o /out/buildctl ./cmd/buildctl")) r := llb.Image("docker.io/library/alpine:latest").With( copyAll(buildctl, "/bin"),