@@ -82,10 +82,19 @@ var (
8282 Hidden : true ,
8383 }
8484
85+ << << << < HEAD
8586 skipSDKCheckFlag = & cli.BoolFlag {
8687 Name : "skip-sdk-check" ,
8788 Required : false ,
8889 Hidden : true ,
90+ || || || | parent of 031 d559 (set custom dockerfile path )
91+ == == == =
92+ dockerFileFlag = & cli.StringFlag {
93+ Name : "dockerfile" ,
94+ Usage : "Path to the Dockerfile to use for the agent. If unset, will use the Dockerfile in the working directory." ,
95+ Required : false ,
96+ Aliases : []string {"f" },
97+ >> >> >> > 031 d559 (set custom dockerfile path )
8998 }
9099
91100 AgentCommands = []* cli.Command {
@@ -104,7 +113,12 @@ var (
104113 secretsFileFlag ,
105114 silentFlag ,
106115 regionFlag ,
116+ << << << < HEAD
107117 skipSDKCheckFlag ,
118+ || || || | parent of 031 d559 (set custom dockerfile path )
119+ == == == =
120+ dockerFileFlag ,
121+ >> >> >> > 031 d559 (set custom dockerfile path )
108122 },
109123 // NOTE: since secrets may contain commas, or indeed any special character we might want to treat as a flag separator,
110124 // we disable it entirely here and require multiple --secrets flags to be used.
@@ -129,6 +143,7 @@ var (
129143 Flags : []cli.Flag {
130144 secretsFlag ,
131145 secretsFileFlag ,
146+ dockerFileFlag ,
132147 },
133148 // NOTE: since secrets may contain commas, or indeed any special character we might want to treat as a flag separator,
134149 // we disable it entirely here and require multiple --secrets flags to be used.
@@ -381,8 +396,11 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
381396 return fmt .Errorf ("unable to determine project type: %w, please use a supported project type, or create your own Dockerfile in the current directory" , err )
382397 }
383398
384- if err := requireDockerfile (ctx , cmd , workingDir , projectType , settingsMap ); err != nil {
385- return err
399+ dockerfile := cmd .String ("dockerfile" )
400+ if dockerfile == "" {
401+ if err := requireDockerfile (ctx , cmd , workingDir , settingsMap ); err != nil {
402+ return err
403+ }
386404 }
387405
388406 if err := agentfs .CheckSDKVersion (workingDir , projectType , settingsMap ); err != nil {
@@ -409,6 +427,7 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
409427 }
410428
411429 lkConfig .Agent .ID = resp .AgentId
430+ lkConfig .Agent .Dockerfile = dockerfile
412431 if err := lkConfig .SaveTOMLFile (workingDir , tomlFilename ); err != nil {
413432 return err
414433 }
@@ -419,7 +438,7 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
419438 }
420439
421440 fmt .Printf ("Created agent with ID [%s]\n " , util .Accented (resp .AgentId ))
422- err = agentfs .Build (ctx , resp .AgentId , project )
441+ err = agentfs .Build (ctx , resp .AgentId , project , dockerfile )
423442 if err != nil {
424443 return err
425444 }
@@ -527,6 +546,8 @@ func deployAgent(ctx context.Context, cmd *cli.Command) error {
527546 return err
528547 }
529548
549+ dockerfile := cmd.String ("dockerfile ")
550+
530551 req = & lkproto.DeployAgentRequest {
531552 AgentId : agentId ,
532553 }
@@ -578,7 +599,7 @@ func deployAgent(ctx context.Context, cmd *cli.Command) error {
578599 }
579600
580601 fmt.Printf ("Updated agent [% s ]\n ", util.Accented (resp.AgentId ))
581- err = agentfs .Build (ctx , resp .AgentId , project )
602+ err = agentfs.Build (ctx , resp.AgentId , project , dockerfile )
582603 if err != nil {
583604 return err
584605 }
0 commit comments