@@ -41,6 +41,12 @@ export interface InstallOpts {
4141 daemonConfig ?: string ;
4242}
4343
44+ interface LimaImage {
45+ location : string ;
46+ arch : string ;
47+ digest ?: string ;
48+ }
49+
4450export class Install {
4551 private readonly runDir : string ;
4652 private readonly version : string ;
@@ -163,6 +169,7 @@ export class Install {
163169 return new handlebars . SafeString ( JSON . stringify ( obj ) ) ;
164170 } ) ;
165171 const limaCfg = handlebars . compile ( limaYamlData ) ( {
172+ customImages : Install . limaCustomImages ( ) ,
166173 daemonConfig : limaDaemonConfig ,
167174 dockerSock : `${ limaDir } /docker.sock` ,
168175 dockerBinVersion : this . _version ,
@@ -512,4 +519,25 @@ EOF`,
512519 }
513520 return releases [ version ] ;
514521 }
522+
523+ public static limaCustomImages ( ) : LimaImage [ ] {
524+ const res : LimaImage [ ] = [ ] ;
525+ const env = process . env . LIMA_IMAGES ;
526+ if ( ! env ) {
527+ return res ;
528+ }
529+ for ( const input of Util . getList ( env , { ignoreComma : true , comment : '#' } ) ) {
530+ const archIndex = input . indexOf ( ':' ) ;
531+ const arch = input . substring ( 0 , archIndex ) . trim ( ) ;
532+ const digestIndex = input . indexOf ( '@' ) ;
533+ const location = input . substring ( archIndex + 1 , digestIndex !== - 1 ? digestIndex : undefined ) . trim ( ) ;
534+ const digest = digestIndex !== - 1 ? input . substring ( digestIndex + 1 ) . trim ( ) : '' ;
535+ res . push ( {
536+ location : location ,
537+ arch : arch ,
538+ digest : digest
539+ } ) ;
540+ }
541+ return res ;
542+ }
515543}
0 commit comments