mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-12-13 01:11:15 +00:00
Compare commits
78 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
714148933e | ||
|
|
56702790ee | ||
|
|
b989044537 | ||
|
|
f2e530b12f | ||
|
|
db7d380101 | ||
|
|
e61617a16c | ||
|
|
4d3a27b3a8 | ||
|
|
84eefba60b | ||
|
|
71cca025e9 | ||
|
|
beedf3fcfc | ||
|
|
efe9e3891a | ||
|
|
78e4df2bef | ||
|
|
9321b687cf | ||
|
|
276a2f38a4 | ||
|
|
4160483120 | ||
|
|
b71d5ee00d | ||
|
|
d3f310eaa3 | ||
|
|
c8283cc2af | ||
|
|
3fb92d6d9c | ||
|
|
138843162e | ||
|
|
4d8e316444 | ||
|
|
13bc64bf22 | ||
|
|
9b44f456e3 | ||
|
|
db9988d080 | ||
|
|
80ba8d8f5f | ||
|
|
48f9dddab2 | ||
|
|
746efa2ccb | ||
|
|
46897a6289 | ||
|
|
74ac62f5d7 | ||
|
|
a4da7e5ab9 | ||
|
|
8f22df35b2 | ||
|
|
d2d8fc9bf5 | ||
|
|
de8d0f39ec | ||
|
|
0d6d6d60ff | ||
|
|
29412e2cf6 | ||
|
|
59de7d6072 | ||
|
|
7fa26c3c14 | ||
|
|
3072e160e1 | ||
|
|
efe6ba76e3 | ||
|
|
1211ebfa1f | ||
|
|
63f2e57f85 | ||
|
|
b7bb1d4426 | ||
|
|
7db77378a9 | ||
|
|
2d89c571bd | ||
|
|
f27261ca18 | ||
|
|
a39f563e16 | ||
|
|
54c51f4ee8 | ||
|
|
364f5e215c | ||
|
|
b60f85385d | ||
|
|
643c69a8cb | ||
|
|
5c724e91b0 | ||
|
|
c2d73c1a11 | ||
|
|
bb512e8cb4 | ||
|
|
36de8cc80a | ||
|
|
f96ea45537 | ||
|
|
6b291a174a | ||
|
|
d44b774c56 | ||
|
|
057bfa9666 | ||
|
|
0f738e9bf9 | ||
|
|
a329cfc112 | ||
|
|
979ffe9e09 | ||
|
|
847482916a | ||
|
|
d6e275d4ff | ||
|
|
370a7dad4b | ||
|
|
23c3839175 | ||
|
|
b814c39737 | ||
|
|
75153b5b5e | ||
|
|
3a56725668 | ||
|
|
fde3095c59 | ||
|
|
d22c57e6c4 | ||
|
|
6172ee107f | ||
|
|
2a248d822c | ||
|
|
6dbd87054b | ||
|
|
68b1efda1d | ||
|
|
7188e7a998 | ||
|
|
927974f719 | ||
|
|
1439ace8f2 | ||
|
|
b86a7cc004 |
16 changed files with 999 additions and 399 deletions
116
.github/workflows/ci.yml
vendored
116
.github/workflows/ci.yml
vendored
|
|
@ -18,6 +18,7 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_VERSION: v27.3.1
|
DOCKER_VERSION: v27.3.1
|
||||||
|
DOCKER_BUILD_SUMMARY: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
|
|
@ -27,16 +28,17 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
- ubuntu-24.04-arm
|
||||||
- macos-13
|
- macos-15-intel
|
||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
|
- ""
|
||||||
- v27.3.1
|
- v27.3.1
|
||||||
- type=image,tag=27.3.1
|
- type=image,tag=27.3.1
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -50,13 +52,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
- ubuntu-24.04-arm
|
||||||
- macos-13
|
- macos-15-intel
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -71,13 +73,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
- ubuntu-24.04-arm
|
||||||
- macos-13
|
- macos-15-intel
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -98,13 +100,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
- ubuntu-24.04-arm
|
||||||
- macos-13
|
- macos-15-intel
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -117,12 +119,11 @@ jobs:
|
||||||
docker context inspect foo
|
docker context inspect foo
|
||||||
|
|
||||||
lima-start-args:
|
lima-start-args:
|
||||||
#runs-on: macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
runs-on: macos-15-intel
|
||||||
runs-on: macos-13
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -142,7 +143,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Uninstall containerd
|
name: Uninstall containerd
|
||||||
if: matrix.containerd == 'containerd-tarball'
|
if: matrix.containerd == 'containerd-tarball'
|
||||||
|
|
@ -182,12 +183,11 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
- macos-15-intel
|
||||||
- macos-13
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -221,7 +221,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -242,7 +242,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -259,7 +259,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -270,3 +270,75 @@ jobs:
|
||||||
name: List contexts
|
name: List contexts
|
||||||
run: |
|
run: |
|
||||||
docker context ls
|
docker context ls
|
||||||
|
|
||||||
|
tcp:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- ubuntu-24.04-arm
|
||||||
|
- macos-15-intel
|
||||||
|
- windows-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
id: setup_docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ env.DOCKER_VERSION }}
|
||||||
|
tcp-port: 2378
|
||||||
|
-
|
||||||
|
name: Check docker info through TCP
|
||||||
|
run: |
|
||||||
|
docker info
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }}
|
||||||
|
|
||||||
|
undock-regctl-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
undock_version:
|
||||||
|
- ''
|
||||||
|
- v0.9.0
|
||||||
|
regctl_version:
|
||||||
|
- ''
|
||||||
|
- v0.8.2
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: type=image
|
||||||
|
env:
|
||||||
|
UNDOCK_VERSION: ${{ matrix.undock_version }}
|
||||||
|
REGCTL_VERSION: ${{ matrix.regctl_version }}
|
||||||
|
|
||||||
|
docker-29:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-15-intel
|
||||||
|
- windows-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Set up Docker
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: v29.0.0-rc.1
|
||||||
|
channel: test
|
||||||
|
|
|
||||||
17
.github/workflows/pr-assign-author.yml
vendored
Normal file
17
.github/workflows/pr-assign-author.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
name: pr-assign-author
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
21
.github/workflows/publish.yml
vendored
Normal file
21
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
-
|
||||||
|
name: Publish
|
||||||
|
uses: actions/publish-immutable-action@v0.0.4
|
||||||
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
|
@ -17,15 +17,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v6
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
|
source: .
|
||||||
files: ./coverage/clover.xml
|
files: ./coverage/clover.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
|
||||||
18
.github/workflows/validate.yml
vendored
18
.github/workflows/validate.yml
vendored
|
|
@ -15,16 +15,17 @@ jobs:
|
||||||
prepare:
|
prepare:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
targets: ${{ steps.targets.outputs.matrix }}
|
targets: ${{ steps.generate.outputs.targets }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Targets matrix
|
name: List targets
|
||||||
id: targets
|
id: generate
|
||||||
run: |
|
uses: docker/bake-action/subaction/list-targets@v6
|
||||||
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
|
with:
|
||||||
|
target: validate
|
||||||
|
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -35,11 +36,8 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v6
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|
|
||||||
99
README.md
99
README.md
|
|
@ -31,6 +31,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)
|
||||||
|
* [inputs.version](#inputsversion)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
|
|
@ -51,7 +52,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: docker/setup-docker-action@v3
|
uses: docker/setup-docker-action@v4
|
||||||
```
|
```
|
||||||
|
|
||||||
### Daemon configuration
|
### Daemon configuration
|
||||||
|
|
@ -73,7 +74,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: docker/setup-docker-action@v3
|
uses: docker/setup-docker-action@v4
|
||||||
with:
|
with:
|
||||||
daemon-config: |
|
daemon-config: |
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +102,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: docker/setup-docker-action@v3
|
uses: docker/setup-docker-action@v4
|
||||||
env:
|
env:
|
||||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||||
```
|
```
|
||||||
|
|
@ -112,22 +113,92 @@ jobs:
|
||||||
|
|
||||||
The following inputs can be used as `step.with` keys
|
The following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
|-------------------|--------|------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `version` | String | `latest` | Docker CE version (e.g., `v24.0.6`). |
|
| `version` | String | `latest` | Docker version to use. See [inputs.version](#inputs.version). |
|
||||||
| `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/) (`stable` or `test`). Only applicable to `type=archive` |
|
||||||
| `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. |
|
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
|
||||||
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||||
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||||
|
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
||||||
|
| `runtime-basedir` | String | `<home>/setup-docker-action` | Docker runtime base directory |
|
||||||
|
| `github-token` | String | `${{ github.token }}` | Optional GitHub Token used to get releases and download assets to avoid rate limitation. On GitHub Enterprise, you might need to set a PAT for `github.com`. |
|
||||||
|
|
||||||
|
### inputs.version
|
||||||
|
|
||||||
|
By default, the latest stable version of Docker is fetched from download.docker.com.
|
||||||
|
|
||||||
|
You can specify a specific version number (e.g. `v27.4.0`).
|
||||||
|
Which is a shorthand for the full comma separated value:
|
||||||
|
|
||||||
|
`type=archive,channel=stable,version=v27.4.0`
|
||||||
|
|
||||||
|
You can also use this full csv format instead.
|
||||||
|
|
||||||
|
Currently supported source types are:
|
||||||
|
- `archive`
|
||||||
|
- `image`
|
||||||
|
|
||||||
|
#### `type=archive`
|
||||||
|
| Key | Default | Description |
|
||||||
|
|-----------|------------|--------------------------------------------------------------------------------------|
|
||||||
|
| `type` | `archive` | The source type of the Docker binaries. Possible values are `archive` and `image`. |
|
||||||
|
| `channel` | `stable` | The download.docker.com channel (`stable` or `test`). |
|
||||||
|
| `version` | `latest` | The Docker version to use. |
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```yaml
|
||||||
|
# last stable released version
|
||||||
|
version: latest
|
||||||
|
version: type=archive # same as above
|
||||||
|
version: version=latest # same as above
|
||||||
|
version: type=archive,version=latest # same as above
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# v27.3.0-rc.1 from test channel
|
||||||
|
version: type=archive,version=27.3.0-rc.1,channel=test
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `type=image`
|
||||||
|
|
||||||
|
Other possible source type is `image` which will pull the Docker binaries from the `moby/moby-bin` and
|
||||||
|
`dockereng/cli-bin` Docker Hub repositories.
|
||||||
|
The advantage of using this source type is that these images are built by the Moby and Docker CI pipelines
|
||||||
|
for each branch and PR, so you can use the `tag` input to install a specific version or branch (e.g. `master`).
|
||||||
|
|
||||||
|
| Key | Default | Description |
|
||||||
|
|-----------|------------|--------------------------------------------------------------------------------------|
|
||||||
|
| `tag` | `latest` | The image tag to use. |
|
||||||
|
|
||||||
|
See https://hub.docker.com/r/moby/moby-bin/tags and https://hub.docker.com/r/dockereng/cli-bin/tags for available tags.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```yaml
|
||||||
|
# install last stable released version from bin images
|
||||||
|
version: type=image
|
||||||
|
version: type=image,tag=latest # same as above
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# a cutting-edge version from the `master` branch
|
||||||
|
version: type=image,tag=master
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# install v27.4.0 from bin images
|
||||||
|
version: type=image,tag=27.4.0
|
||||||
|
```
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
The following outputs are available
|
The following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|--------|--------|--------------------|
|
|--------|--------|---------------------------------------|
|
||||||
| `sock` | String | Docker socket path |
|
| `sock` | String | Docker socket path |
|
||||||
|
| `tcp` | String | Docker TCP address if tcp-port is set |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import {beforeEach, describe, expect, test} from '@jest/globals';
|
import {beforeEach, describe, expect, test} from '@jest/globals';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
|
|
@ -30,7 +32,9 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -52,7 +56,9 @@ describe('getInputs', () => {
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -70,7 +76,9 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: true
|
setHost: true,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -90,7 +98,9 @@ describe('getInputs', () => {
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -108,7 +118,9 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -128,6 +140,8 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -147,6 +161,8 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -165,6 +181,8 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -183,6 +201,31 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: true,
|
rootless: true,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
} as context.Inputs
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9,
|
||||||
|
new Map<string, string>([
|
||||||
|
['version', 'v24.0.8'],
|
||||||
|
['tcp-port', '2378'],
|
||||||
|
['set-host', 'false'],
|
||||||
|
['rootless', 'false'],
|
||||||
|
]),
|
||||||
|
{
|
||||||
|
source: {
|
||||||
|
type: 'archive',
|
||||||
|
version: 'v24.0.8',
|
||||||
|
channel: 'stable'
|
||||||
|
},
|
||||||
|
context: '',
|
||||||
|
daemonConfig: '',
|
||||||
|
tcpPort: 2378,
|
||||||
|
rootless: false,
|
||||||
|
setHost: false,
|
||||||
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
])(
|
])(
|
||||||
|
|
|
||||||
12
action.yml
12
action.yml
|
|
@ -17,6 +17,9 @@ inputs:
|
||||||
daemon-config:
|
daemon-config:
|
||||||
description: 'Docker daemon JSON configuration'
|
description: 'Docker daemon JSON configuration'
|
||||||
required: false
|
required: false
|
||||||
|
tcp-port:
|
||||||
|
description: 'TCP port to expose the Docker API locally'
|
||||||
|
required: false
|
||||||
context:
|
context:
|
||||||
description: 'Docker context name. (default setup-docker-action)'
|
description: 'Docker context name. (default setup-docker-action)'
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -28,10 +31,19 @@ inputs:
|
||||||
description: 'Enable Docker rootless mode'
|
description: 'Enable Docker rootless mode'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
|
runtime-basedir:
|
||||||
|
description: 'Docker runtime base directory'
|
||||||
|
required: false
|
||||||
|
github-token:
|
||||||
|
description: "GitHub Token used to get releases and download assets"
|
||||||
|
default: ${{ github.token }}
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
sock:
|
sock:
|
||||||
description: "Docker socket path"
|
description: "Docker socket path"
|
||||||
|
tcp:
|
||||||
|
description: "Docker TCP address if tcp-port is set"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
|
|
|
||||||
28
dist/index.js
generated
vendored
28
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
6
dist/licenses.txt
generated
vendored
6
dist/licenses.txt
generated
vendored
|
|
@ -2532,9 +2532,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
dot-object
|
|
||||||
MIT
|
|
||||||
|
|
||||||
encoding
|
encoding
|
||||||
MIT
|
MIT
|
||||||
Copyright (c) 2012-2014 Andris Reinman
|
Copyright (c) 2012-2014 Andris Reinman
|
||||||
|
|
@ -4247,9 +4244,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
twirp-ts
|
|
||||||
MIT
|
|
||||||
|
|
||||||
undici
|
undici
|
||||||
MIT
|
MIT
|
||||||
MIT License
|
MIT License
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
target "_common" {
|
||||||
|
args = {
|
||||||
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["build"]
|
targets = ["build"]
|
||||||
}
|
}
|
||||||
|
|
@ -11,42 +17,49 @@ group "validate" {
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "build-update"
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build-validate" {
|
target "build-validate" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "build-validate"
|
target = "build-validate"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "format-update"
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "lint" {
|
target "lint" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "lint"
|
target = "lint"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-update" {
|
target "vendor-update" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-update"
|
target = "vendor-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-validate" {
|
target "vendor-validate" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-validate"
|
target = "vendor-validate"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "test" {
|
target "test" {
|
||||||
|
inherits = ["_common"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "test-coverage"
|
target = "test-coverage"
|
||||||
output = ["./coverage"]
|
output = ["./coverage"]
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
"packageManager": "yarn@3.6.3",
|
"packageManager": "yarn@3.6.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@docker/actions-toolkit": "^0.47.0"
|
"@docker/actions-toolkit": "^0.69.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.6.0",
|
"@types/node": "^20.6.0",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
|
import os from 'os';
|
||||||
|
import path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {InstallSource} from '@docker/actions-toolkit/lib/docker/install';
|
|
||||||
import {parse} from 'csv-parse/sync';
|
import {parse} from 'csv-parse/sync';
|
||||||
|
|
||||||
|
import {InstallSource} from '@docker/actions-toolkit/lib/docker/install';
|
||||||
|
import {Util} from '@docker/actions-toolkit/lib/util';
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
source: InstallSource;
|
source: InstallSource;
|
||||||
daemonConfig?: string;
|
daemonConfig?: string;
|
||||||
|
tcpPort?: number;
|
||||||
context: string;
|
context: string;
|
||||||
setHost: boolean;
|
setHost: boolean;
|
||||||
rootless: boolean;
|
rootless: boolean;
|
||||||
|
runtimeBasedir: string;
|
||||||
|
githubToken: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
|
|
@ -21,9 +28,12 @@ export function getInputs(): Inputs {
|
||||||
return {
|
return {
|
||||||
source: source,
|
source: source,
|
||||||
daemonConfig: core.getInput('daemon-config'),
|
daemonConfig: core.getInput('daemon-config'),
|
||||||
|
tcpPort: Util.getInputNumber('tcp-port'),
|
||||||
context: core.getInput('context'),
|
context: core.getInput('context'),
|
||||||
setHost: core.getBooleanInput('set-host'),
|
setHost: core.getBooleanInput('set-host'),
|
||||||
rootless: core.getBooleanInput('rootless')
|
rootless: core.getBooleanInput('rootless'),
|
||||||
|
runtimeBasedir: core.getInput('runtime-basedir') || path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
46
src/main.ts
46
src/main.ts
|
|
@ -1,30 +1,66 @@
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import os from 'os';
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
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';
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install';
|
||||||
|
import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install';
|
||||||
|
|
||||||
import * as context from './context';
|
import * as context from './context';
|
||||||
import * as stateHelper from './state-helper';
|
import * as stateHelper from './state-helper';
|
||||||
|
|
||||||
|
const regctlDefaultVersion = 'v0.8.3';
|
||||||
|
const undockDefaultVersion = 'v0.10.0';
|
||||||
|
|
||||||
actionsToolkit.run(
|
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-${crypto.randomUUID().slice(0, 8)}`);
|
const runDir = path.join(input.runtimeBasedir, `run-${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.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.source.type === 'image') {
|
||||||
|
await core.group(`Download and install regctl`, async () => {
|
||||||
|
const regclientInstall = new RegclientInstall({githubToken: input.githubToken});
|
||||||
|
const regclientBinPath = await regclientInstall.download(
|
||||||
|
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
|
||||||
|
? process.env.REGCTL_VERSION
|
||||||
|
: regctlDefaultVersion,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
await regclientInstall.install(regclientBinPath);
|
||||||
|
});
|
||||||
|
await core.group(`Download and install undock`, async () => {
|
||||||
|
const undockInstall = new UndockInstall({githubToken: input.githubToken});
|
||||||
|
const undockBinPath = await undockInstall.download(
|
||||||
|
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
|
||||||
|
? process.env.UNDOCK_VERSION
|
||||||
|
: undockDefaultVersion,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
await undockInstall.install(undockBinPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let tcpPort: number | undefined;
|
||||||
|
let tcpAddress: string | undefined;
|
||||||
|
if (input.tcpPort) {
|
||||||
|
tcpPort = input.tcpPort;
|
||||||
|
tcpAddress = `tcp://127.0.0.1:${tcpPort}`;
|
||||||
|
}
|
||||||
|
|
||||||
const install = new Install({
|
const install = new Install({
|
||||||
runDir: runDir,
|
runDir: runDir,
|
||||||
source: input.source,
|
source: input.source,
|
||||||
rootless: input.rootless,
|
rootless: input.rootless,
|
||||||
contextName: input.context || 'setup-docker-action',
|
contextName: input.context || 'setup-docker-action',
|
||||||
daemonConfig: input.daemonConfig
|
daemonConfig: input.daemonConfig,
|
||||||
|
localTCPPort: tcpPort,
|
||||||
|
githubToken: input.githubToken
|
||||||
});
|
});
|
||||||
let toolDir;
|
let toolDir;
|
||||||
if (!(await Docker.isAvailable()) || input.source) {
|
if (!(await Docker.isAvailable()) || input.source) {
|
||||||
|
|
@ -38,6 +74,10 @@ actionsToolkit.run(
|
||||||
await core.group(`Setting outputs`, async () => {
|
await core.group(`Setting outputs`, async () => {
|
||||||
core.info(`sock=${sockPath}`);
|
core.info(`sock=${sockPath}`);
|
||||||
core.setOutput('sock', sockPath);
|
core.setOutput('sock', sockPath);
|
||||||
|
if (tcpAddress) {
|
||||||
|
core.info(`tcp=${tcpAddress}`);
|
||||||
|
core.setOutput('tcp', tcpAddress);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (input.setHost) {
|
if (input.setHost) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue