Skip to content

Commit 90da0a6

Browse files
committed
JSON stringify cachefrom option for builds
A change the way options are serialized in docker-modem causes an issue with builds using the `cachefrom` option and library tests to fail. This change can be reverted if apocas/dockerode#793 is merged. Change-type: patch Relates-to: apocas/docker-modem#181 Relates-to: apocas/dockerode#792
1 parent 1bb90bb commit 90da0a6

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/multibuild/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ export function generateBuildTasks(
7878
// translating to dockerode ImageBuildOptions properties
7979
{
8080
dockerOpts: {
81-
...(cachefrom ? { cachefrom } : {}),
81+
// TODO: JSON serialization should no longer be necessary
82+
// if https://github.com/apocas/dockerode/pull/793 is merged
83+
...(cachefrom ? { cachefrom: JSON.stringify(cachefrom) } : {}),
8284
...(shmsize ? { shmsize } : {}),
8385
...(target ? { target } : {}),
8486
...(extrahosts ? { extrahosts } : {}),

test/multibuild/build.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ describe('Specifying build options', async () => {
693693
expect(newTask)
694694
.to.have.property('dockerOpts')
695695
.that.has.property('cachefrom')
696-
.that.deep.equals(['alpine:latest']);
696+
.that.deep.equals(JSON.stringify(['alpine:latest']));
697697

698698
expect(image).to.not.have.property('error');
699699
});

0 commit comments

Comments
 (0)