File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const main = async () => {
88 const layerCache = new LayerCache ( repotag )
99 await layerCache . store ( key )
1010 const layercache2 = new LayerCache ( repotag )
11- layercache2 . imagesDir = `docker_images_restore`
11+ // layercache2.imagesDir = `docker_images_restore`
1212 await layercache2 . restore ( key )
1313}
1414
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class LayerCache {
1010 repotag : string
1111 originalKeyToStore : string = ''
1212 // tarFile: string = ''
13- imagesDir : string = ' docker_images'
13+ imagesDir : string = `./.action-docker-layer-caching- docker_images`
1414 // unpackedTarDir: string = ''
1515 // manifests: Manifests = []
1616
@@ -35,6 +35,7 @@ class LayerCache {
3535 const storeRoot = await this . storeRoot ( )
3636 // const storeLayers = this.storeLayers()
3737 // await Promise.all([storeRoot, storeLayers])
38+ await this . cleanUp ( )
3839 }
3940
4041 private async saveImageAsUnpacked ( ) {
@@ -115,6 +116,7 @@ class LayerCache {
115116 // }
116117 // await this.joinAllLayerCaches()
117118 await this . loadImageFromUnpacked ( )
119+ await this . cleanUp ( )
118120 return true
119121 }
120122
@@ -145,10 +147,14 @@ class LayerCache {
145147 await exec . exec ( `sh -c` , [ `tar cf - '${ this . getUnpackedTarDir ( ) } ' | docker load` ] )
146148 }
147149
150+ async cleanUp ( ) {
151+ await fs . rmdir ( this . getImagesDir ( ) , { recursive : true } )
152+ }
153+
148154 // ---
149155
150156 getImagesDir ( ) : string {
151- return ` ${ __dirname } / ${ this . imagesDir } `
157+ return this . imagesDir
152158 }
153159
154160 getUnpackedTarDir ( ) : string {
You can’t perform that action at this time.
0 commit comments