mount cache support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
89c7136f75
commit
f336164699
@ -2,7 +2,6 @@ package dagger
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -29,11 +28,20 @@ func (mnt *Mount) Validate(defs ...string) error {
|
|||||||
|
|
||||||
func (mnt *Mount) LLB(ctx context.Context, s Solver) (llb.RunOption, error) {
|
func (mnt *Mount) LLB(ctx context.Context, s Solver) (llb.RunOption, error) {
|
||||||
if err := mnt.Validate("#MountTmp"); err == nil {
|
if err := mnt.Validate("#MountTmp"); err == nil {
|
||||||
return llb.AddMount(mnt.dest, llb.Scratch(), llb.Tmpfs()), nil
|
return llb.AddMount(
|
||||||
|
mnt.dest,
|
||||||
|
llb.Scratch(),
|
||||||
|
llb.Tmpfs(),
|
||||||
|
), nil
|
||||||
}
|
}
|
||||||
if err := mnt.Validate("#MountCache"); err == nil {
|
if err := mnt.Validate("#MountCache"); err == nil {
|
||||||
// FIXME: cache mount
|
return llb.AddMount(
|
||||||
return nil, fmt.Errorf("FIXME: cache mount not yet implemented")
|
mnt.dest,
|
||||||
|
llb.Scratch(),
|
||||||
|
llb.AsPersistentCacheDir(
|
||||||
|
mnt.v.Path().String(),
|
||||||
|
llb.CacheMountShared,
|
||||||
|
)), nil
|
||||||
}
|
}
|
||||||
// Compute source component or script, discarding fs writes & output value
|
// Compute source component or script, discarding fs writes & output value
|
||||||
from, err := newExecutable(mnt.v.Lookup("from"))
|
from, err := newExecutable(mnt.v.Lookup("from"))
|
||||||
|
Reference in New Issue
Block a user