Skip to content

Commit e416dff

Browse files
Add input for runtime basedir
1 parent 29412e2 commit e416dff

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ The following inputs can be used as `step.with` keys
121121
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
122122
| `context` | String | `setup-docker-action` | Docker context name. |
123123
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
124-
| `rootless` | Bool | `false` | Start daemon in rootless mode |
125-
124+
| `rootless` | Bool | `false` | Start daemon in rootless mode |
125+
| `runtime-basedir` | String | `<home>/setup-docker-action` | Docker runtime base directory
126126
### inputs.version
127127

128128
By default, the latest stable version of Docker is fetched from download.docker.com.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ inputs:
3131
description: 'Enable Docker rootless mode'
3232
default: 'false'
3333
required: false
34+
runtime-basedir:
35+
description: 'Docker runtime base directory'
36+
required: false
3437

3538
outputs:
3639
sock:

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Inputs {
1111
context: string;
1212
setHost: boolean;
1313
rootless: boolean;
14+
runtimeBasedir?: string;
1415
}
1516

1617
export function getInputs(): Inputs {
@@ -27,7 +28,8 @@ export function getInputs(): Inputs {
2728
tcpPort: Util.getInputNumber('tcp-port'),
2829
context: core.getInput('context'),
2930
setHost: core.getBooleanInput('set-host'),
30-
rootless: core.getBooleanInput('rootless')
31+
rootless: core.getBooleanInput('rootless'),
32+
runtimeBasedir: core.getInput('runtime-basedir')
3133
};
3234
}
3335

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ actionsToolkit.run(
1818
// main
1919
async () => {
2020
const input: context.Inputs = context.getInputs();
21-
const runDir = path.join(os.homedir(), `setup-docker-action-${crypto.randomUUID().slice(0, 8)}`);
21+
const runBasedir = input.runtimeBasedir || path.join(os.homedir(), `setup-docker-action`);
22+
const runDir = path.join(runBasedir, `run-${crypto.randomUUID().slice(0, 8)}`);
2223

2324
if (input.context == 'default') {
2425
throw new Error(`'default' context cannot be used.`);

0 commit comments

Comments
 (0)