Skip to content

Commit 4fd1554

Browse files
lionellondeloof
authored andcommitted
expose build.shm_size as Build.ShmSize
Signed-off-by: Lionello Lunesu <[email protected]>
1 parent 4ab556c commit 4fd1554

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

loader/loader_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,23 @@ services:
965965
image: db
966966
build:
967967
context: ./db
968+
shm_size: 2gb
968969
`
969970
configDetails := buildConfigDetails(dict, nil)
970-
_, err := Load(configDetails)
971+
actual, err := Load(configDetails)
971972
assert.NilError(t, err)
973+
974+
wd, _ := os.Getwd()
975+
assert.DeepEqual(t, actual.Services["web"].Build, &types.BuildConfig{
976+
Context: wd,
977+
Dockerfile: "Dockerfile",
978+
})
979+
980+
assert.DeepEqual(t, actual.Services["db"].Build, &types.BuildConfig{
981+
Context: wd + "/db",
982+
Dockerfile: "Dockerfile",
983+
ShmSize: types.UnitBytes(2 * 1024 * 1024 * 1024),
984+
})
972985
}
973986

974987
func TestDeprecatedProperties(t *testing.T) {

types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ type BuildConfig struct {
281281
Network string `yaml:"network,omitempty" json:"network,omitempty"`
282282
Target string `yaml:"target,omitempty" json:"target,omitempty"`
283283
Secrets []ServiceSecretConfig `yaml:"secrets,omitempty" json:"secrets,omitempty"`
284+
ShmSize UnitBytes `yaml:"shm_size,omitempty" json:"shm_size,omitempty"`
284285
Tags StringList `yaml:"tags,omitempty" json:"tags,omitempty"`
285286
Ulimits map[string]*UlimitsConfig `yaml:"ulimits,omitempty" json:"ulimits,omitempty"`
286287
Platforms StringList `yaml:"platforms,omitempty" json:"platforms,omitempty"`

0 commit comments

Comments
 (0)