@@ -28,12 +28,14 @@ import (
28
28
"syscall"
29
29
"time"
30
30
31
+ "github.com/compose-spec/compose-go/types"
31
32
"github.com/docker/cli/cli"
32
33
"github.com/pkg/errors"
33
34
"github.com/sirupsen/logrus"
34
35
"github.com/spf13/cobra"
35
36
36
37
"github.com/docker/compose-cli/api/backend"
38
+ api "github.com/docker/compose-cli/api/compose"
37
39
"github.com/docker/compose-cli/api/config"
38
40
apicontext "github.com/docker/compose-cli/api/context"
39
41
"github.com/docker/compose-cli/api/context/store"
@@ -223,7 +225,14 @@ func main() {
223
225
224
226
if ctype != store .DefaultContextType {
225
227
// On default context, "compose" is implemented by CLI Plugin
226
- root .AddCommand (compose .RootCommand (ctype , service .ComposeService ()))
228
+ proxy := api .NewServiceProxy ().WithService (service .ComposeService ())
229
+ command := compose .RootCommand (ctype , proxy )
230
+
231
+ if ctype == store .AciContextType {
232
+ customizeCliForACI (command , proxy )
233
+ }
234
+
235
+ root .AddCommand (command )
227
236
}
228
237
229
238
if err = root .ExecuteContext (ctx ); err != nil {
@@ -232,6 +241,22 @@ func main() {
232
241
metrics .Track (ctype , os .Args [1 :], metrics .SuccessStatus )
233
242
}
234
243
244
+ func customizeCliForACI (command * cobra.Command , proxy * api.ServiceProxy ) {
245
+ var domainName string
246
+ for _ , c := range command .Commands () {
247
+ if c .Name () == "up" {
248
+ c .Flags ().StringVar (& domainName , "domainname" , "" , "Container NIS domain name" )
249
+ proxy .WithInterceptor (func (ctx context.Context , project * types.Project ) {
250
+ if domainName != "" {
251
+ // arbitrarily set the domain name on the first service ; ACI backend will expose the entire project
252
+ project .Services [0 ].DomainName = domainName
253
+ }
254
+
255
+ })
256
+ }
257
+ }
258
+ }
259
+
235
260
func getBackend (ctype string , configDir string , opts cliopts.GlobalOpts ) (backend.Service , error ) {
236
261
switch ctype {
237
262
case store .DefaultContextType , store .LocalContextType :
0 commit comments