Version: 0.15.1
The trailing slash in the destination path of withFile in containerB results in the file having the name of the destination directory.
Shouldn't the output of containerB and containerC be the same?
Code:
import { connect } from '@dagger.io/dagger';
async function main() {
await connect(async (client) => {
const containerA = client.container().from('alpine').withWorkdir('/app').withExec(['touch', 'a']);
const containerB = client
.container()
.from('alpine')
.withWorkdir('/app')
.withFile('/app/', containerA.file('/app/a'));
const containerC = client
.container()
.from('alpine')
.withWorkdir('/app')
.withFile('/app/a', containerA.file('/app/a'));
console.log(await containerB.withExec(['tree', '/app']).stdout());
console.log(await containerC.withExec(['tree', '/app']).stdout());
});
}
main();
Output:
/app
└── app
0 directories, 1 files
/app
└── a
0 directories, 1 files