mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
bake: support compose build cache_to
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
3cf549a7f7
commit
b438032a60
@ -100,6 +100,7 @@ func ParseCompose(dt []byte) (*Config, error) {
|
|||||||
return val, ok
|
return val, ok
|
||||||
})),
|
})),
|
||||||
CacheFrom: s.Build.CacheFrom,
|
CacheFrom: s.Build.CacheFrom,
|
||||||
|
CacheTo: s.Build.CacheTo,
|
||||||
NetworkMode: &s.Build.Network,
|
NetworkMode: &s.Build.Network,
|
||||||
Secrets: secrets,
|
Secrets: secrets,
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@ services:
|
|||||||
none
|
none
|
||||||
args:
|
args:
|
||||||
buildno: 123
|
buildno: 123
|
||||||
|
cache_from:
|
||||||
|
- type=local,src=path/to/cache
|
||||||
|
cache_to:
|
||||||
|
- type=local,dest=path/to/cache
|
||||||
secrets:
|
secrets:
|
||||||
- token
|
- token
|
||||||
- aws
|
- aws
|
||||||
@ -54,6 +58,8 @@ secrets:
|
|||||||
require.Equal(t, "Dockerfile-alternate", *c.Targets[1].Dockerfile)
|
require.Equal(t, "Dockerfile-alternate", *c.Targets[1].Dockerfile)
|
||||||
require.Equal(t, 1, len(c.Targets[1].Args))
|
require.Equal(t, 1, len(c.Targets[1].Args))
|
||||||
require.Equal(t, "123", c.Targets[1].Args["buildno"])
|
require.Equal(t, "123", c.Targets[1].Args["buildno"])
|
||||||
|
require.Equal(t, c.Targets[1].CacheFrom, []string{"type=local,src=path/to/cache"})
|
||||||
|
require.Equal(t, c.Targets[1].CacheTo, []string{"type=local,dest=path/to/cache"})
|
||||||
require.Equal(t, "none", *c.Targets[1].NetworkMode)
|
require.Equal(t, "none", *c.Targets[1].NetworkMode)
|
||||||
require.Equal(t, []string{
|
require.Equal(t, []string{
|
||||||
"id=token,env=ENV_TOKEN",
|
"id=token,env=ENV_TOKEN",
|
||||||
@ -253,6 +259,8 @@ services:
|
|||||||
dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
cache_from:
|
cache_from:
|
||||||
- user/app:cache
|
- user/app:cache
|
||||||
|
cache_to:
|
||||||
|
- user/app:cache
|
||||||
tags:
|
tags:
|
||||||
- ct-addon:baz
|
- ct-addon:baz
|
||||||
args:
|
args:
|
||||||
@ -267,7 +275,8 @@ services:
|
|||||||
- linux/arm64
|
- linux/arm64
|
||||||
cache-from:
|
cache-from:
|
||||||
- type=local,src=path/to/cache
|
- type=local,src=path/to/cache
|
||||||
cache-to: type=local,dest=path/to/cache
|
cache-to:
|
||||||
|
- type=local,dest=path/to/cache
|
||||||
pull: true
|
pull: true
|
||||||
|
|
||||||
aws:
|
aws:
|
||||||
@ -297,7 +306,7 @@ services:
|
|||||||
require.Equal(t, c.Targets[0].Tags, []string{"ct-addon:baz", "ct-addon:foo", "ct-addon:alp"})
|
require.Equal(t, c.Targets[0].Tags, []string{"ct-addon:baz", "ct-addon:foo", "ct-addon:alp"})
|
||||||
require.Equal(t, c.Targets[0].Platforms, []string{"linux/amd64", "linux/arm64"})
|
require.Equal(t, c.Targets[0].Platforms, []string{"linux/amd64", "linux/arm64"})
|
||||||
require.Equal(t, c.Targets[0].CacheFrom, []string{"type=local,src=path/to/cache"})
|
require.Equal(t, c.Targets[0].CacheFrom, []string{"type=local,src=path/to/cache"})
|
||||||
require.Equal(t, c.Targets[0].CacheTo, []string{"type=local,dest=path/to/cache"})
|
require.Equal(t, c.Targets[0].CacheTo, []string{"user/app:cache", "type=local,dest=path/to/cache"})
|
||||||
require.Equal(t, c.Targets[0].Pull, newBool(true))
|
require.Equal(t, c.Targets[0].Pull, newBool(true))
|
||||||
require.Equal(t, c.Targets[1].Tags, []string{"ct-fake-aws:bar"})
|
require.Equal(t, c.Targets[1].Tags, []string{"ct-fake-aws:bar"})
|
||||||
require.Equal(t, c.Targets[1].Secrets, []string{"id=mysecret,src=/local/secret", "id=mysecret2,src=/local/secret2"})
|
require.Equal(t, c.Targets[1].Secrets, []string{"id=mysecret,src=/local/secret", "id=mysecret2,src=/local/secret2"})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user