Hello I attempted to build a subdirectory using the directory's dockerfile by doing
docker.buildImage(
tar.pack(resolve('./', cwd)),
{
f: resolve('../docker-images/nodejs/Dockerfile'),
t: settings.name
},
(err, output) => {
output.pipe(process.stdout)
}
)
However it seems to ignore the f property thus reporting error:
Error: (HTTP code 500) server error - Cannot locate specified Dockerfile: Dockerfile
Or do I have to include the Dockerfile in the tar pack already rather than setting a custom dockerfile in the options?
Looking at my code that uses this, I include the Dockerfile in the tarball and provide the path by adding a dockerfile property on the options object.
See here for an example
Thanks that a way to do it :+1:
3 years after....thanks @Seikho !
Here is a quick visual example for future visitors. 馃コ
await dockerode.buildImage({
context: __dirname,
src: ['path/to/Dockerfile', 'dependency1', 'dependency2', '...']
}, {
t: imageName + ':' + version,
dockerfile: 'path/to/Dockerfile'
});
Most helpful comment
3 years after....thanks @Seikho !
Here is a quick visual example for future visitors. 馃コ