From a46d6c55b1f069fdd548027d3abd495eaa0f5b4b Mon Sep 17 00:00:00 2001 From: Lionello Lunesu Date: Wed, 20 Dec 2023 10:38:57 -0800 Subject: [PATCH 1/2] expose build.shm_size as Build.ShmSize Signed-off-by: Lionello Lunesu --- loader/loader_test.go | 17 +++++++++++++++-- types/types.go | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/loader/loader_test.go b/loader/loader_test.go index 3e1ad481..a1802513 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -957,10 +957,23 @@ services: image: db build: context: ./db + shm_size: 2gb ` configDetails := buildConfigDetails(dict, nil) - _, err := Load(configDetails) + actual, err := Load(configDetails) assert.NilError(t, err) + + wd, _ := os.Getwd() + assert.DeepEqual(t, actual.Services["web"].Build, &types.BuildConfig{ + Context: wd, + Dockerfile: "Dockerfile", + }) + + assert.DeepEqual(t, actual.Services["db"].Build, &types.BuildConfig{ + Context: wd + "/db", + Dockerfile: "Dockerfile", + ShmSize: types.UnitBytes(2 * 1024 * 1024 * 1024), + }) } func TestDeprecatedProperties(t *testing.T) { @@ -2768,7 +2781,7 @@ services: image: example/proxy build: ./proxy develop: - watch: + watch: # rebuild image and recreate service - path: ./proxy/proxy.conf action: sync+restart diff --git a/types/types.go b/types/types.go index 2eb75680..3ec9223c 100644 --- a/types/types.go +++ b/types/types.go @@ -281,6 +281,7 @@ type BuildConfig struct { Network string `yaml:"network,omitempty" json:"network,omitempty"` Target string `yaml:"target,omitempty" json:"target,omitempty"` Secrets []ServiceSecretConfig `yaml:"secrets,omitempty" json:"secrets,omitempty"` + ShmSize UnitBytes `yaml:"shm_size,omitempty" json:"shm_size,omitempty"` Tags StringList `yaml:"tags,omitempty" json:"tags,omitempty"` Ulimits map[string]*UlimitsConfig `yaml:"ulimits,omitempty" json:"ulimits,omitempty"` Platforms StringList `yaml:"platforms,omitempty" json:"platforms,omitempty"` From 2af0a3fa58929f55c14fac35d1f5bb42ca3f255d Mon Sep 17 00:00:00 2001 From: Lionello Lunesu Date: Wed, 20 Dec 2023 11:32:28 -0800 Subject: [PATCH 2/2] use filepath.Join Signed-off-by: Lionello Lunesu --- loader/loader_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/loader_test.go b/loader/loader_test.go index a1802513..538e9ba0 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -970,7 +970,7 @@ services: }) assert.DeepEqual(t, actual.Services["db"].Build, &types.BuildConfig{ - Context: wd + "/db", + Context: filepath.Join(wd, "db"), Dockerfile: "Dockerfile", ShmSize: types.UnitBytes(2 * 1024 * 1024 * 1024), })