writeFileToContainer function
Implementation
Future<void> writeFileToContainer(
String name,
String remotePath,
String content,
) async {
// Write to a temp file, then docker cp
final tmpFile = File('/tmp/openci-tmp-${const Uuid().v4()}');
await tmpFile.writeAsString(content);
try {
await copyToContainer(name, tmpFile.path, remotePath);
} finally {
try {
await tmpFile.delete();
} catch (_) {}
}
}