mirror of
https://forgejo.merr.is/annika/actions-docker-extract.git
synced 2025-12-13 12:54:30 -05:00
✨ Extract path from Docker Image (#1)
This commit is contained in:
parent
f6106497d3
commit
bf80417647
11 changed files with 3800 additions and 0 deletions
20
src/extract.js
Normal file
20
src/extract.js
Normal 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();
|
||||
Loading…
Add table
Add a link
Reference in a new issue