@@ -127,13 +127,16 @@ export class Install {
127127 const cli = await HubRepository . build ( 'dockereng/cli-bin' ) ;
128128 extractFolder = await cli . extractImage ( tag ) ;
129129
130- // Daemon is only available for Windows and Linux
131- if ( [ 'win32' , 'linux' ] . includes ( platform ) ) {
130+ if ( [ 'win32' , 'linux' , 'darwin' ] . includes ( platform ) ) {
132131 core . info ( `Downloading dockerd from moby/moby-bin:${ tag } ` ) ;
133132 const moby = await HubRepository . build ( 'moby/moby-bin' ) ;
134- await moby . extractImage ( tag , extractFolder ) ;
133+
134+ // On macOS, we extract the Linux version of dockerd which will be run in a lima VM.
135+ const extractPlatform = platform == 'darwin' ? 'linux' : undefined ;
136+
137+ await moby . extractImage ( tag , extractFolder , extractPlatform ) ;
135138 } else {
136- core . info ( `dockerd not supported on ${ platform } ` ) ;
139+ core . warning ( `dockerd not supported on ${ platform } , only the Docker cli will be available ` ) ;
137140 }
138141 break ;
139142 }
@@ -192,10 +195,7 @@ export class Install {
192195 }
193196
194197 private async installDarwin ( ) : Promise < string > {
195- if ( this . source . type !== 'archive' ) {
196- throw new Error ( 'Only archive source is supported on macOS' ) ;
197- }
198- const src = this . source as InstallSourceArchive ;
198+ const src = this . source ;
199199 const limaDir = path . join ( os . homedir ( ) , '.lima' , this . limaInstanceName ) ;
200200 await io . mkdirP ( limaDir ) ;
201201 const dockerHost = `unix://${ limaDir } /docker.sock` ;
@@ -226,12 +226,16 @@ export class Install {
226226 handlebars . registerHelper ( 'stringify' , function ( obj ) {
227227 return new handlebars . SafeString ( JSON . stringify ( obj ) ) ;
228228 } ) ;
229+ const srcArchive = src as InstallSourceArchive ;
229230 const limaCfg = handlebars . compile ( limaYamlData ) ( {
230231 customImages : Install . limaCustomImages ( ) ,
231232 daemonConfig : limaDaemonConfig ,
232233 dockerSock : `${ limaDir } /docker.sock` ,
233- dockerBinVersion : src . version . replace ( / ^ v / , '' ) ,
234- dockerBinChannel : src . channel
234+ srcType : src . type ,
235+ srcArchiveVersion : srcArchive . version ?. replace ( / ^ v / , '' ) ,
236+ srcArchiveChannel : srcArchive . channel ,
237+ srcImageTag : ( src as InstallSourceImage ) . tag ,
238+ toolDir : this . toolDir
235239 } ) ;
236240 core . info ( `Writing lima config to ${ path . join ( limaDir , 'lima.yaml' ) } ` ) ;
237241 fs . writeFileSync ( path . join ( limaDir , 'lima.yaml' ) , limaCfg ) ;
0 commit comments