mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-06-14 07:27:13 +02:00
Compare commits
74 Commits
Author | SHA1 | Date | |
---|---|---|---|
26145a578d | |||
0692aeebfc | |||
47611ea40b | |||
7bb565780b | |||
9794ac9406 | |||
701bc4e9ed | |||
958155397b | |||
de4e249b98 | |||
a2e96b1577 | |||
2e05eb17ec | |||
b52307508d | |||
a3485f7b8f | |||
1977c86a96 | |||
e98084b722 | |||
ca246a1805 | |||
40c64fb090 | |||
4acbcb8479 | |||
8f832606d8 | |||
4f5bb9fcef | |||
da44386179 | |||
f4a5b99d88 | |||
c794b17d99 | |||
e188b1d368 | |||
e0c95fcf69 | |||
25cb73f3c4 | |||
a93701ec9b | |||
3a19e60609 | |||
78318f8be5 | |||
54f3988321 | |||
f437b67409 | |||
06b9bc80b3 | |||
a6fae2d4e8 | |||
a4ef905acc | |||
41a5151e81 | |||
e96e0e2c98 | |||
8d0a8e33ff | |||
9bd97ff018 | |||
bca5e4d3e2 | |||
031a2987b7 | |||
753106f35c | |||
a1e4314d8f | |||
a7f3aad3f5 | |||
faa196892b | |||
796ce734cb | |||
3eb24de4f6 | |||
5bddaa4323 | |||
17819a1af9 | |||
d20884258e | |||
b74351ab97 | |||
0f5a011c3d | |||
99cad45695 | |||
aceee1722e | |||
0cb459c59a | |||
81886c7276 | |||
fdc6583d4e | |||
a4b15f09d5 | |||
c2351bbd0b | |||
c14b6e1c32 | |||
f1d16883d0 | |||
5de1d6bef5 | |||
7d4fd999a5 | |||
38c07112bd | |||
c6f8a8a2ba | |||
2960188cea | |||
8e060aa468 | |||
fc6fa62ba9 | |||
7864da88cb | |||
36eedea576 | |||
95a170fa60 | |||
1ea15ee881 | |||
729d91c21f | |||
c553dd0c3f | |||
a307846a9f | |||
57929789e6 |
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@ -4,6 +4,11 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
ignore:
|
||||||
|
# ignore this dependency
|
||||||
|
# it seems a bug with dependabot as pining to commit sha should not
|
||||||
|
# trigger a new version similar to https://github.com/docker/buildx/pull/2222#issuecomment-1919092153
|
||||||
|
- dependency-name: "docker/actions-toolkit"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
- "bot"
|
- "bot"
|
||||||
|
89
.github/workflows/ci.yml
vendored
89
.github/workflows/ci.yml
vendored
@ -1,5 +1,9 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
@ -13,7 +17,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_VERSION: v23.0.6
|
DOCKER_VERSION: v24.0.9
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
@ -23,8 +27,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
- macos-13
|
- macos-13
|
||||||
- macos-latest
|
|
||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
- pinned
|
- pinned
|
||||||
@ -33,6 +37,11 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set version
|
name: Set version
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -57,17 +66,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: v23.0.0-rc.4
|
version: v24.0.0-rc.4
|
||||||
channel: test
|
channel: test
|
||||||
-
|
-
|
||||||
name: Dump context
|
name: Dump context
|
||||||
@ -81,12 +96,18 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -110,12 +131,18 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -132,11 +159,16 @@ jobs:
|
|||||||
uses: crazy-max/ghaction-dump-context@v2
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
lima-start-args:
|
lima-start-args:
|
||||||
runs-on: macos-latest
|
#runs-on: macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
runs-on: macos-13
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -145,10 +177,21 @@ jobs:
|
|||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
containerd:
|
||||||
|
- containerd-system
|
||||||
|
- containerd-tarball
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Uninstall containerd
|
||||||
|
if: matrix.containerd == 'containerd-tarball'
|
||||||
|
run: |
|
||||||
|
sudo apt-get remove -y containerd.io
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -166,7 +209,7 @@ jobs:
|
|||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
push: true
|
push: true
|
||||||
@ -187,12 +230,18 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
- macos-13
|
- macos-13
|
||||||
- macos-latest
|
- macos-12
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
# https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
name: Set up QEMU
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -210,7 +259,7 @@ jobs:
|
|||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
push: true
|
push: true
|
||||||
@ -249,3 +298,23 @@ jobs:
|
|||||||
name: Dump context
|
name: Dump context
|
||||||
if: always()
|
if: always()
|
||||||
uses: crazy-max/ghaction-dump-context@v2
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
|
||||||
|
set-host:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
set-host: true
|
||||||
|
-
|
||||||
|
name: List contexts
|
||||||
|
run: |
|
||||||
|
docker context ls
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v2
|
||||||
|
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@ -1,5 +1,9 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -16,11 +20,12 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v5
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
6
.github/workflows/validate.yml
vendored
6
.github/workflows/validate.yml
vendored
@ -1,5 +1,9 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -36,6 +40,6 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v5
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
874
.yarn/releases/yarn-3.6.3.cjs
vendored
874
.yarn/releases/yarn-3.6.3.cjs
vendored
File diff suppressed because one or more lines are too long
@ -11,5 +11,3 @@ nodeLinker: node-modules
|
|||||||
plugins:
|
plugins:
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-3.6.3.cjs
|
|
||||||
|
44
README.md
44
README.md
@ -9,6 +9,11 @@
|
|||||||
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
||||||
Works on Linux, macOS and Windows.
|
Works on Linux, macOS and Windows.
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Does not work on macOS runners with ARM architecture (no nested virtualization):
|
||||||
|
> * https://github.com/crazy-max/ghaction-setup-docker/pull/53
|
||||||
|
> * https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
___
|
___
|
||||||
@ -19,6 +24,7 @@ ___
|
|||||||
* [Define custom `limactl start` arguments (macOS)](#define-custom-limactl-start-arguments-macos)
|
* [Define custom `limactl start` arguments (macOS)](#define-custom-limactl-start-arguments-macos)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
|
* [outputs](#outputs)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
|
|
||||||
@ -38,9 +44,32 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v2
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> macOS runners hang with latest QEMU 9.1.0. You need to install QEMU 9.0.2 as
|
||||||
|
> a workaround:
|
||||||
|
> ```yaml
|
||||||
|
> name: ci
|
||||||
|
>
|
||||||
|
> on:
|
||||||
|
> push:
|
||||||
|
>
|
||||||
|
> jobs:
|
||||||
|
> docker:
|
||||||
|
> runs-on: macos-13
|
||||||
|
> steps:
|
||||||
|
> -
|
||||||
|
> # https://github.com/crazy-max/ghaction-setup-docker/issues/108
|
||||||
|
> name: Install QEMU 9.0.2
|
||||||
|
> uses: docker/actions-toolkit/.github/actions/macos-setup-qemu@19ca9ade20f5da695f76a10988d6532058575f82
|
||||||
|
> -
|
||||||
|
> name: Set up Docker
|
||||||
|
> uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
> ```
|
||||||
|
> More info: https://github.com/crazy-max/ghaction-setup-docker/issues/108.
|
||||||
|
|
||||||
### Daemon configuration
|
### Daemon configuration
|
||||||
|
|
||||||
You can [configure the Docker daemon](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file)
|
You can [configure the Docker daemon](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file)
|
||||||
@ -60,7 +89,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v2
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
with:
|
with:
|
||||||
daemon-config: |
|
daemon-config: |
|
||||||
{
|
{
|
||||||
@ -88,7 +117,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v2
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
env:
|
env:
|
||||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||||
```
|
```
|
||||||
@ -105,6 +134,15 @@ The following inputs can be used as `step.with` keys
|
|||||||
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
||||||
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
||||||
| `context` | String | `setup-docker-action` | Docker context name. |
|
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||||
|
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||||
|
|
||||||
|
### outputs
|
||||||
|
|
||||||
|
The following outputs are available
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|--------|--------|--------------------|
|
||||||
|
| `sock` | String | Docker socket path |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
@ -17,38 +17,45 @@ describe('getInputs', () => {
|
|||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['version', 'v23.0.1'],
|
['version', 'v24.0.8'],
|
||||||
|
['set-host', 'false'],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
version: 'v23.0.1',
|
version: 'v24.0.8',
|
||||||
channel: '',
|
channel: '',
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
|
setHost: false
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
['version', 'v23.0.0-rc.4'],
|
['version', 'v24.0.0-rc.4'],
|
||||||
['channel', 'test'],
|
['channel', 'test'],
|
||||||
['context', 'foo'],
|
['context', 'foo'],
|
||||||
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
|
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
|
||||||
|
['set-host', 'false'],
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
version: 'v23.0.0-rc.4',
|
version: 'v24.0.0-rc.4',
|
||||||
channel: 'test',
|
channel: 'test',
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
|
setHost: false
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
new Map<string, string>([]),
|
new Map<string, string>([
|
||||||
|
['set-host', 'true'],
|
||||||
|
]),
|
||||||
{
|
{
|
||||||
version: 'latest',
|
version: 'latest',
|
||||||
channel: '',
|
channel: '',
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
|
setHost: true
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
|
10
action.yml
10
action.yml
@ -8,7 +8,7 @@ branding:
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Docker CE version. (e.g, v23.0.1)'
|
description: 'Docker CE version. (e.g, v24.0.9)'
|
||||||
required: false
|
required: false
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
channel:
|
channel:
|
||||||
@ -20,6 +20,14 @@ inputs:
|
|||||||
context:
|
context:
|
||||||
description: 'Docker context name. (default setup-docker-action)'
|
description: 'Docker context name. (default setup-docker-action)'
|
||||||
required: false
|
required: false
|
||||||
|
set-host:
|
||||||
|
description: 'Set DOCKER_HOST environment variable to docker socket path'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
sock:
|
||||||
|
description: "Docker socket path"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
|
@ -4,8 +4,13 @@ ARG NODE_VERSION=20
|
|||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git
|
||||||
RUN yarn config set --home enableTelemetry 0
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||||
|
corepack enable
|
||||||
|
yarn --version
|
||||||
|
yarn config set --home enableTelemetry 0
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
95
dist/index.js
generated
vendored
95
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3322
dist/licenses.txt
generated
vendored
3322
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -26,9 +26,8 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"packageManager": "yarn@3.6.3",
|
"packageManager": "yarn@3.6.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@docker/actions-toolkit": "^0.16.0",
|
"@docker/actions-toolkit": "^0.40.0"
|
||||||
"uuid": "^9.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.6.0",
|
"@types/node": "^20.6.0",
|
||||||
|
@ -5,6 +5,7 @@ export interface Inputs {
|
|||||||
channel: string;
|
channel: string;
|
||||||
daemonConfig?: string;
|
daemonConfig?: string;
|
||||||
context: string;
|
context: string;
|
||||||
|
setHost: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
@ -12,6 +13,7 @@ export function getInputs(): Inputs {
|
|||||||
version: core.getInput('version') || 'latest',
|
version: core.getInput('version') || 'latest',
|
||||||
channel: core.getInput('channel'),
|
channel: core.getInput('channel'),
|
||||||
daemonConfig: core.getInput('daemon-config'),
|
daemonConfig: core.getInput('daemon-config'),
|
||||||
context: core.getInput('context')
|
context: core.getInput('context'),
|
||||||
|
setHost: core.getBooleanInput('set-host')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
src/main.ts
17
src/main.ts
@ -1,6 +1,6 @@
|
|||||||
|
import * as crypto from 'crypto';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as uuid from 'uuid';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
||||||
@ -13,7 +13,7 @@ actionsToolkit.run(
|
|||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
const input: context.Inputs = context.getInputs();
|
const input: context.Inputs = context.getInputs();
|
||||||
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
|
const runDir = path.join(os.homedir(), `setup-docker-action-${crypto.randomUUID().slice(0, 8)}`);
|
||||||
|
|
||||||
if (input.context == 'default') {
|
if (input.context == 'default') {
|
||||||
throw new Error(`'default' context cannot be used.`);
|
throw new Error(`'default' context cannot be used.`);
|
||||||
@ -34,7 +34,18 @@ actionsToolkit.run(
|
|||||||
}
|
}
|
||||||
if (toolDir) {
|
if (toolDir) {
|
||||||
stateHelper.setRunDir(runDir);
|
stateHelper.setRunDir(runDir);
|
||||||
await install.install();
|
const sockPath = await install.install();
|
||||||
|
await core.group(`Setting outputs`, async () => {
|
||||||
|
core.info(`sock=${sockPath}`);
|
||||||
|
core.setOutput('sock', sockPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (input.setHost) {
|
||||||
|
await core.group(`Setting Docker host`, async () => {
|
||||||
|
core.exportVariable('DOCKER_HOST', sockPath);
|
||||||
|
core.info(`DOCKER_HOST=${sockPath}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await core.group(`Docker info`, async () => {
|
await core.group(`Docker info`, async () => {
|
||||||
|
Reference in New Issue
Block a user