Extract path from Docker Image (#1)

This commit is contained in:
Samuel Ryan 2020-08-29 16:20:01 +01:00 committed by GitHub
parent f6106497d3
commit bf80417647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 3800 additions and 0 deletions

20
src/extract.js Normal file
View file

@ -0,0 +1,20 @@
const core = require('@actions/core');
const exec = require('@actions/exec');
async function run() {
try {
const image = core.getInput('image');
const path = core.getInput('path');
const destination = `.extracted-${Date.now()}`;
const create = `docker cp $(docker create ${image}):/${path} ${destination}`;
await exec.exec(`mkdir -p ${destination}`);
await exec.exec(`/bin/bash -c "${create}"`, []);
core.setOutput('destination', destination);
} catch (error) {
core.setFailed(error.message);
}
}
run();