Merge pull request #999 from gtardif/compose_build_flags

Add compose build flags for file and working dir
This commit is contained in:
Guillaume Tardif 2020-12-02 11:18:43 +01:00 committed by GitHub
commit 1d71be31b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,9 @@ func buildCommand() *cobra.Command {
return runBuild(cmd.Context(), opts, args)
},
}
buildCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
buildCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
return buildCmd
}

View File

@ -37,6 +37,13 @@ func TestLocalBackendComposeUp(t *testing.T) {
networkList := c.RunDockerCmd("--context", "default", "network", "ls")
t.Run("build", func(t *testing.T) {
res := c.RunDockerCmd("compose", "build", "-f", "../../tests/composefiles/demo_multi_port.yaml")
res.Assert(t, icmd.Expected{Out: "COPY words.sql /docker-entrypoint-initdb.d/"})
res.Assert(t, icmd.Expected{Out: "COPY pom.xml ."})
res.Assert(t, icmd.Expected{Out: "COPY static /static/"})
})
t.Run("up", func(t *testing.T) {
c.RunDockerCmd("compose", "up", "-f", "../../tests/composefiles/demo_multi_port.yaml", "--project-name", projectName)
})