@@ -106,11 +106,15 @@ impl RustwideBuilder {
106106 self . skip_build_if_exists = should;
107107 }
108108
109- fn prepare_sandbox ( & self , limits : & Limits ) -> SandboxBuilder {
110- SandboxBuilder :: new ( )
109+ fn prepare_sandbox ( & self , metadata : & Metadata , limits : & Limits ) -> Result < SandboxBuilder > {
110+ let mut builder = SandboxBuilder :: new ( )
111111 . cpu_limit ( self . config . build_cpu_limit . map ( |limit| limit as f32 ) )
112112 . memory_limit ( Some ( limits. memory ( ) ) )
113- . enable_networking ( limits. networking ( ) )
113+ . enable_networking ( limits. networking ( ) ) ;
114+ if let Some ( image) = metadata. docker_image ( ) {
115+ builder = builder. image ( SandboxImage :: remote ( & image) ?)
116+ }
117+ Ok ( builder)
114118 }
115119
116120 pub fn update_toolchain ( & mut self ) -> Result < ( ) > {
@@ -208,11 +212,11 @@ impl RustwideBuilder {
208212 let krate = Crate :: crates_io ( DUMMY_CRATE_NAME , DUMMY_CRATE_VERSION ) ;
209213 krate. fetch ( & self . workspace ) ?;
210214
215+ let metadata = Metadata :: from_crate_root ( & build_dir. build_dir ( ) ) ?;
216+
211217 build_dir
212- . build ( & self . toolchain , & krate, self . prepare_sandbox ( & limits) )
218+ . build ( & self . toolchain , & krate, self . prepare_sandbox ( & metadata , & limits) ? )
213219 . run ( |build| {
214- let metadata = Metadata :: from_crate_root ( & build. host_source_dir ( ) ) ?;
215-
216220 let res = self . execute_build ( HOST_TARGET , true , build, & limits, & metadata) ?;
217221 if !res. result . successful {
218222 failure:: bail!( "failed to build dummy crate for {}" , self . rustc_version) ;
@@ -322,14 +326,14 @@ impl RustwideBuilder {
322326
323327 let local_storage = tempfile:: Builder :: new ( ) . prefix ( "docsrs-docs" ) . tempdir ( ) ?;
324328
329+ let metadata = Metadata :: from_crate_root ( & build_dir. build_dir ( ) ) ?;
325330 let res = build_dir
326- . build ( & self . toolchain , & krate, self . prepare_sandbox ( & limits) )
331+ . build ( & self . toolchain , & krate, self . prepare_sandbox ( & metadata , & limits) ? )
327332 . run ( |build| {
328333 use docsrs_metadata:: BuildTargets ;
329334
330335 let mut has_docs = false ;
331336 let mut successful_targets = Vec :: new ( ) ;
332- let metadata = Metadata :: from_crate_root ( & build. host_source_dir ( ) ) ?;
333337 let BuildTargets {
334338 default_target,
335339 other_targets,
0 commit comments