File tree Expand file tree Collapse file tree 3 files changed +15
-24
lines changed Expand file tree Collapse file tree 3 files changed +15
-24
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "type" : " added" ,
3+ "description" : " add support for pre-build hooks with remote docker" ,
4+ "issues" : [928 ]
5+ }
Original file line number Diff line number Diff line change @@ -943,7 +943,14 @@ pub(crate) fn run(
943943 docker. arg ( "-t" ) ;
944944 }
945945
946- docker. arg ( & image_name ( & options. config , target) ?) ;
946+ let mut image = options. image_name ( ) ?;
947+ if options. needs_custom_image ( ) {
948+ image = options
949+ . custom_image_build ( & paths, msg_info)
950+ . wrap_err ( "when building custom image" ) ?;
951+ }
952+
953+ docker. arg ( & image) ;
947954 if !is_tty {
948955 // ensure the process never exits until we stop it
949956 // we only need this infinite loop if we don't allocate
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ impl DockerOptions {
7474 paths : & DockerPaths ,
7575 msg_info : & mut MessageInfo ,
7676 ) -> Result < String > {
77- let mut image = image_name ( & self . config , & self . target ) ?;
77+ let mut image = self . image_name ( ) ?;
7878
7979 if let Some ( path) = self . config . dockerfile ( & self . target ) ? {
8080 let context = self . config . dockerfile_context ( & self . target ) ?;
@@ -167,28 +167,7 @@ impl DockerOptions {
167167 }
168168
169169 pub ( crate ) fn image_name ( & self ) -> Result < String > {
170- if let Some ( image) = self . config . image ( & self . target ) ? {
171- return Ok ( image) ;
172- }
173-
174- if !DOCKER_IMAGES . contains ( & self . target . triple ( ) ) {
175- eyre:: bail!(
176- "`cross` does not provide a Docker image for target {target}, \
177- specify a custom image in `Cross.toml`.",
178- target = self . target
179- ) ;
180- }
181-
182- let version = if include_str ! ( concat!( env!( "OUT_DIR" ) , "/commit-info.txt" ) ) . is_empty ( ) {
183- env ! ( "CARGO_PKG_VERSION" )
184- } else {
185- "main"
186- } ;
187-
188- Ok ( format ! (
189- "{CROSS_IMAGE}/{target}:{version}" ,
190- target = self . target
191- ) )
170+ image_name ( & self . config , & self . target )
192171 }
193172}
194173
You can’t perform that action at this time.
0 commit comments