@@ -36,8 +36,8 @@ const (
3636type Manifest struct {
3737 Schema string `json:"$schema"`
3838 Resources map [string ]* Resource `json:"resources"`
39- // BicepFiles holds any bicep files generated by Aspire next to the manifest file.
40- BicepFiles * memfs.FS `json:"-"`
39+ // Files holds any files generated by Aspire next to the manifest file.
40+ Files * memfs.FS `json:"-"`
4141 // publish mode intention from the manifest
4242 publishMode apphostPublishMode `json:"-"`
4343}
@@ -299,12 +299,12 @@ func ManifestFromAppHost(
299299 manifestDir = filepath .Dir (appHostProject )
300300 }
301301
302- manifest .BicepFiles = memfs .New ()
302+ manifest .Files = memfs .New ()
303303
304304 for resourceName , res := range manifest .Resources {
305305 if res .Path != nil {
306306 if res .Type == "azure.bicep.v0" || res .Type == "azure.bicep.v1" {
307- e := manifest .BicepFiles .MkdirAll (resourceName , osutil .PermissionDirectory )
307+ e := manifest .Files .MkdirAll (resourceName , osutil .PermissionDirectory )
308308 if e != nil {
309309 return nil , e
310310 }
@@ -318,7 +318,7 @@ func ManifestFromAppHost(
318318 }
319319 }
320320 * res .Path = filepath .Join (resourceName , filepath .Base (* res .Path ))
321- e = manifest .BicepFiles .WriteFile (* res .Path , content , osutil .PermissionFile )
321+ e = manifest .Files .WriteFile (* res .Path , content , osutil .PermissionFile )
322322 if e != nil {
323323 return nil , e
324324 }
@@ -337,7 +337,7 @@ func ManifestFromAppHost(
337337 "unexpected deployment type %q. Supported types: [azure.bicep.v0, azure.bicep.v1]" , res .Deployment .Type )
338338 }
339339 // use a folder with the name of the resource
340- e := manifest .BicepFiles .MkdirAll (resourceName , osutil .PermissionDirectory )
340+ e := manifest .Files .MkdirAll (resourceName , osutil .PermissionDirectory )
341341 if e != nil {
342342 return nil , e
343343 }
@@ -346,7 +346,7 @@ func ManifestFromAppHost(
346346 return nil , fmt .Errorf ("reading bicep file from deployment property: %w" , e )
347347 }
348348 * res .Deployment .Path = filepath .Join (resourceName , filepath .Base (* res .Deployment .Path ))
349- e = manifest .BicepFiles .WriteFile (* res .Deployment .Path , content , osutil .PermissionFile )
349+ e = manifest .Files .WriteFile (* res .Deployment .Path , content , osutil .PermissionFile )
350350 if e != nil {
351351 return nil , e
352352 }
@@ -372,6 +372,21 @@ func ManifestFromAppHost(
372372 if ! filepath .IsAbs (res .Build .Context ) {
373373 res .Build .Context = filepath .Join (manifestDir , res .Build .Context )
374374 }
375+ // make sure the dockerfile exists
376+ content , e := os .ReadFile (res .Build .Dockerfile )
377+ if e != nil {
378+ return nil , fmt .Errorf ("expecting dockerfile content at %q: %w" , res .Build .Dockerfile , e )
379+ }
380+ // copy the dockerfile (same strategy as bicep files)
381+ e = manifest .Files .MkdirAll (resourceName , osutil .PermissionDirectory )
382+ if e != nil {
383+ return nil , e
384+ }
385+ res .Build .Dockerfile = filepath .Join (resourceName , filepath .Base (res .Build .Dockerfile ))
386+ e = manifest .Files .WriteFile (res .Build .Dockerfile , content , osutil .PermissionFile )
387+ if e != nil {
388+ return nil , e
389+ }
375390 for _ , secret := range res .Build .Secrets {
376391 if secret .Source != nil && ! filepath .IsAbs (* secret .Source ) {
377392 * secret .Source = filepath .Join (manifestDir , * secret .Source )
0 commit comments