@@ -11,41 +11,45 @@ export async function tagDocker(opts: {
1111 latest : boolean ;
1212} ) {
1313 for ( const { name, prefix, main } of REPOS ) {
14- // Check image exists
15- console . log ( `==> Pulling : ${ name } :${ prefix } -${ opts . commit } ` ) ;
14+ // Check both architecture images exist using manifest inspect
15+ console . log ( `==> Checking images exist : ${ name } :${ prefix } -${ opts . commit } -{amd64,arm64 }` ) ;
1616 try {
17- await $ ( {
18- stdout : "ignore" ,
19- stderr : "ignore" ,
20- } ) `docker pull --platform amd64 ${ name } :${ prefix } -${ opts . commit } ` ;
17+ console . log ( `==> Inspecting ${ name } :${ prefix } -${ opts . commit } -amd64` ) ;
18+ await $ `docker manifest inspect ${ name } :${ prefix } -${ opts . commit } -amd64` ;
19+ console . log ( `==> Inspecting ${ name } :${ prefix } -${ opts . commit } -arm64` ) ;
20+ await $ `docker manifest inspect ${ name } :${ prefix } -${ opts . commit } -arm64` ;
21+ console . log ( `==> Both images exist` ) ;
2122 } catch ( error ) {
23+ console . error ( `==> Error inspecting images:` , error ) ;
2224 throw new Error (
23- `Image ${ name } :${ prefix } -${ opts . commit } does not exist on Docker Hub.` ,
25+ `Images ${ name } :${ prefix } -${ opts . commit } -{amd64,arm64} do not exist on Docker Hub. Error: ${ error } ` ,
2426 ) ;
2527 }
2628
27- // Tag with version
28- await tag (
29+ // Create and push manifest with version
30+ await createManifest (
2931 name ,
3032 `${ prefix } -${ opts . commit } ` ,
3133 `${ prefix } -${ opts . version } ` ,
3234 ) ;
3335 if ( main ) {
34- await tag ( name , `${ prefix } -${ opts . commit } ` , opts . version ) ;
36+ await createManifest ( name , `${ prefix } -${ opts . commit } ` , opts . version ) ;
3537 }
3638
37- // Tag with latest
39+ // Create and push manifest with latest
3840 if ( opts . latest ) {
39- await tag ( name , `${ prefix } -${ opts . commit } ` , `${ prefix } -latest` ) ;
41+ await createManifest ( name , `${ prefix } -${ opts . commit } ` , `${ prefix } -latest` ) ;
4042 if ( main ) {
41- await tag ( name , `${ prefix } -${ opts . commit } ` , "latest" ) ;
43+ await createManifest ( name , `${ prefix } -${ opts . commit } ` , "latest" ) ;
4244 }
4345 }
4446 }
4547}
4648
47- async function tag ( image : string , from : string , to : string ) {
48- console . log ( `==> Tagging: ${ image } :${ from } -> ${ image } :${ to } ` ) ;
49- await $ `docker tag ${ image } :${ from } ${ image } :${ to } ` ;
50- await $ `docker push ${ image } :${ to } ` ;
49+ async function createManifest ( image : string , from : string , to : string ) {
50+ console . log ( `==> Creating manifest: ${ image } :${ to } from ${ image } :${ from } -{amd64,arm64}` ) ;
51+
52+ // Use buildx imagetools to create and push multi-arch manifest
53+ // This works with manifest lists as inputs (unlike docker manifest create)
54+ await $ `docker buildx imagetools create --tag ${ image } :${ to } ${ image } :${ from } -amd64 ${ image } :${ from } -arm64` ;
5155}
0 commit comments