Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion loader/full-example.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: full_example_project_name
services:
foo:

bar:
build:
dockerfile_inline: |
FROM alpine
RUN echo "hello" > /world.txt

foo:
build:
context: ./dir
dockerfile: Dockerfile
Expand Down
20 changes: 20 additions & 0 deletions loader/full-struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ func services(workingDir, homeDir string) []types.ServiceConfig {
},
WorkingDir: "/code",
},
{
Name: "bar",
Build: &types.BuildConfig{
DockerfileInline: "FROM alpine\nRUN echo \"hello\" > /world.txt\n",
},
Environment: types.MappingWithEquals{},
Scale: 1,
},
}
}

Expand Down Expand Up @@ -585,6 +593,11 @@ func secrets(workingDir string) map[string]types.SecretConfig {
func fullExampleYAML(workingDir, homeDir string) string {
return fmt.Sprintf(`name: full_example_project_name
services:
bar:
build:
dockerfile_inline: |
FROM alpine
RUN echo "hello" > /world.txt
foo:
build:
context: ./dir
Expand Down Expand Up @@ -1124,6 +1137,13 @@ func fullExampleJSON(workingDir, homeDir string) string {
}
},
"services": {
"bar": {
"build": {
"dockerfile_inline": "FROM alpine\nRUN echo \"hello\" \u003e /world.txt\n"
},
"command": null,
"entrypoint": null
},
"foo": {
"build": {
"context": "./dir",
Expand Down
2 changes: 1 addition & 1 deletion loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ func TestFullExample(t *testing.T) {
expectedConfig := fullExampleProject(workingDir, homeDir)

assert.Check(t, is.DeepEqual(expectedConfig.Name, config.Name))
assert.Check(t, is.DeepEqual(expectedConfig.Services, config.Services))
assert.Check(t, is.DeepEqual(serviceSort(expectedConfig.Services), serviceSort(config.Services)))
assert.Check(t, is.DeepEqual(expectedConfig.Networks, config.Networks))
assert.Check(t, is.DeepEqual(expectedConfig.Volumes, config.Volumes))
assert.Check(t, is.DeepEqual(expectedConfig.Secrets, config.Secrets))
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (s set) toSlice() []string {
type BuildConfig struct {
Context string `yaml:",omitempty" json:"context,omitempty"`
Dockerfile string `yaml:",omitempty" json:"dockerfile,omitempty"`
DockerfileInline string `yaml:"dockerfile_inline,omitempty" json:"dockerfile_inline,omitempty"`
DockerfileInline string `mapstructure:"dockerfile_inline,omitempty" yaml:"dockerfile_inline,omitempty" json:"dockerfile_inline,omitempty"`
Args MappingWithEquals `yaml:",omitempty" json:"args,omitempty"`
SSH SSHConfig `yaml:"ssh,omitempty" json:"ssh,omitempty"`
Labels Labels `yaml:",omitempty" json:"labels,omitempty"`
Expand Down