mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-06-13 15:17:11 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
370a7dad4b | |||
23c3839175 | |||
b814c39737 | |||
75153b5b5e | |||
3a56725668 | |||
fde3095c59 | |||
d22c57e6c4 | |||
6172ee107f | |||
2a248d822c | |||
6dbd87054b | |||
68b1efda1d | |||
7188e7a998 | |||
927974f719 | |||
1439ace8f2 | |||
b86a7cc004 | |||
01efb57f88 | |||
f5dddcbf38 | |||
ccdfecaaf2 | |||
07f0e609c6 | |||
eff8d999dc | |||
57e629a437 | |||
5bf030df68 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -1 +0,0 @@
|
||||
* @crazy-max
|
3
.github/CODE_OF_CONDUCT.md
vendored
Normal file
3
.github/CODE_OF_CONDUCT.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Code of conduct
|
||||
|
||||
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
|
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@ -7,13 +7,13 @@ to the public under the [project's open source license](LICENSE).
|
||||
|
||||
## Submitting a pull request
|
||||
|
||||
1. [Fork](https://github.com/crazy-max/ghaction-setup-docker/fork) and clone the repository
|
||||
1. [Fork](https://github.com/docker/setup-docker-action/fork) and clone the repository
|
||||
2. Configure and install the dependencies: `yarn install`
|
||||
3. Create a new branch: `git checkout -b my-branch-name`
|
||||
4. Make your changes
|
||||
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||
6. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-setup-docker/compare)
|
||||
7. Push to your fork and [submit a pull request](https://github.com/docker/setup-docker-action/compare)
|
||||
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||
|
||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||
|
102
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
102
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
||||
name: Bug Report
|
||||
description: Report a bug
|
||||
labels:
|
||||
- status/triage
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report a bug!
|
||||
If this is a security issue please report it to the [Docker Security team](mailto:security@docker.com).
|
||||
Before submitting a bug report, check out the [Troubleshooting doc](https://github.com/docker/setup-docker-action/blob/master/TROUBLESHOOTING.md).
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Contributing guidelines
|
||||
description: >
|
||||
Make sure you've read the contributing guidelines before proceeding.
|
||||
options:
|
||||
- label: I've read the [contributing guidelines](https://github.com/docker/setup-docker-action/blob/master/.github/CONTRIBUTING.md) and wholeheartedly agree
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "I've found a bug, and:"
|
||||
description: |
|
||||
Make sure that your request fulfills all of the following requirements.
|
||||
If one requirement cannot be satisfied, explain in detail why.
|
||||
options:
|
||||
- label: The documentation does not mention anything about my problem
|
||||
- label: There are no open or closed issues that are related to my problem
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description
|
||||
description: >
|
||||
Provide a brief description of the bug in 1-2 sentences.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: >
|
||||
Describe precisely what you'd expect to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: >
|
||||
Describe precisely what is actually happening.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Repository URL
|
||||
description: >
|
||||
Enter the URL of the repository where you are experiencing the
|
||||
issue. If your repository is private, provide a link to a minimal
|
||||
repository that reproduces the issue.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Workflow run URL
|
||||
description: >
|
||||
Enter the URL of the GitHub Action workflow run if public (e.g.
|
||||
`https://github.com/<user>/<repo>/actions/runs/<id>`)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: YAML workflow
|
||||
description: |
|
||||
Provide the YAML of the workflow that's causing the issue.
|
||||
Make sure to remove any sensitive information.
|
||||
render: yaml
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Workflow logs
|
||||
description: >
|
||||
[Attach](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)
|
||||
the [log file of your workflow run](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||
and make sure to remove any sensitive information.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Docker daemon logs
|
||||
description: >
|
||||
If applicable, provide the Docker logs available in post step.
|
||||
render: text
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional info
|
||||
description: |
|
||||
Provide any additional information that could be useful.
|
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,34 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
---
|
||||
|
||||
### Behaviour
|
||||
|
||||
#### Steps to reproduce this issue
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
#### Expected behaviour
|
||||
|
||||
> Tell us what should happen
|
||||
|
||||
#### Actual behaviour
|
||||
|
||||
> Tell us what happens instead
|
||||
|
||||
### Configuration
|
||||
|
||||
* Repository URL (if public):
|
||||
* Build URL (if public):
|
||||
|
||||
```yml
|
||||
# paste your YAML workflow file here and remove sensitive data
|
||||
```
|
||||
|
||||
### Logs
|
||||
|
||||
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Questions and Discussions
|
||||
url: https://github.com/docker/setup-docker-action/discussions/new
|
||||
about: Use Github Discussions to ask questions and/or open discussion topics.
|
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
||||
name: Feature request
|
||||
description: Missing functionality? Come tell us about it!
|
||||
labels:
|
||||
- kind/enhancement
|
||||
- status/triage
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: What is the feature you want to see?
|
||||
validations:
|
||||
required: true
|
12
.github/SECURITY.md
vendored
Normal file
12
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Reporting security issues
|
||||
|
||||
The project maintainers take security seriously. If you discover a security
|
||||
issue, please bring it to their attention right away!
|
||||
|
||||
**Please _DO NOT_ file a public issue**, instead send your report privately to
|
||||
[security@docker.com](mailto:security@docker.com).
|
||||
|
||||
Security reports are greatly appreciated, and we will publicly thank you for it.
|
||||
We also like to send gifts—if you'd like Docker swag, make sure to let
|
||||
us know. We currently do not offer a paid security bounty program, but are not
|
||||
ruling it out in the future.
|
31
.github/SUPPORT.md
vendored
31
.github/SUPPORT.md
vendored
@ -1,31 +0,0 @@
|
||||
# Support [](https://isitmaintained.com/project/crazy-max/ghaction-setup-docker)
|
||||
|
||||
First, [be a good guy](https://github.com/kossnocorp/etiquette/blob/master/README.md).
|
||||
|
||||
## Reporting an issue
|
||||
|
||||
Please do a search in [open issues](https://github.com/crazy-max/ghaction-setup-docker/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
|
||||
|
||||
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
||||
|
||||
:+1: - upvote
|
||||
|
||||
:-1: - downvote
|
||||
|
||||
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
||||
|
||||
## Writing good bug reports and feature requests
|
||||
|
||||
File a single issue per problem and feature request.
|
||||
|
||||
* Do not enumerate multiple bugs or feature requests in the same issue.
|
||||
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
||||
|
||||
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||
|
||||
You are now ready to [create a new issue](https://github.com/crazy-max/ghaction-setup-docker/issues/new/choose)!
|
||||
|
||||
## Closure policy
|
||||
|
||||
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
||||
* Issues that go a week without a response from original poster are subject to closure at our discretion.
|
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@ -18,6 +18,7 @@ on:
|
||||
|
||||
env:
|
||||
DOCKER_VERSION: v27.3.1
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
|
||||
jobs:
|
||||
main:
|
||||
@ -270,3 +271,31 @@ jobs:
|
||||
name: List contexts
|
||||
run: |
|
||||
docker context ls
|
||||
|
||||
tcp:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||
- macos-13
|
||||
- windows-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
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 }}
|
||||
|
108
README.md
108
README.md
@ -1,14 +1,21 @@
|
||||
[](https://github.com/crazy-max/ghaction-setup-docker/releases/latest)
|
||||
[](https://github.com/docker/setup-docker-action/releases/latest)
|
||||
[](https://github.com/marketplace/actions/docker-setup-docker)
|
||||
[](https://github.com/crazy-max/ghaction-setup-docker/actions?workflow=ci)
|
||||
[](https://github.com/crazy-max/ghaction-setup-docker/actions?workflow=test)
|
||||
[](https://codecov.io/gh/crazy-max/ghaction-setup-docker)
|
||||
[](https://github.com/docker/setup-docker-action/actions?workflow=ci)
|
||||
[](https://github.com/docker/setup-docker-action/actions?workflow=test)
|
||||
[](https://codecov.io/gh/docker/setup-docker-action)
|
||||
|
||||
## About
|
||||
|
||||
GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/).
|
||||
Works on Linux, macOS and Windows.
|
||||
|
||||
> [!NOTE]
|
||||
> This action is useful if you want to pin against a specific Docker version or
|
||||
> set up a custom daemon configuration or if Docker is not available on your
|
||||
> runner. If you're using [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources)
|
||||
> on Linux or Windows, Docker is already up and running, so it might not be
|
||||
> necessary to use this action.
|
||||
|
||||
> [!WARNING]
|
||||
> Does not work on macOS runners with ARM architecture (no nested virtualization):
|
||||
> * https://github.com/crazy-max/ghaction-setup-docker/pull/53
|
||||
@ -24,6 +31,7 @@ ___
|
||||
* [Define custom `limactl start` arguments (macOS)](#define-custom-limactl-start-arguments-macos)
|
||||
* [Customizing](#customizing)
|
||||
* [inputs](#inputs)
|
||||
* [inputs.version](#inputsversion)
|
||||
* [outputs](#outputs)
|
||||
* [Contributing](#contributing)
|
||||
* [License](#license)
|
||||
@ -44,7 +52,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
uses: docker/setup-docker-action@v4
|
||||
```
|
||||
|
||||
### Daemon configuration
|
||||
@ -66,7 +74,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
uses: docker/setup-docker-action@v4
|
||||
with:
|
||||
daemon-config: |
|
||||
{
|
||||
@ -94,7 +102,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
uses: docker/setup-docker-action@v4
|
||||
env:
|
||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||
```
|
||||
@ -107,29 +115,93 @@ The following inputs can be used as `step.with` keys
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| `version` | String | `latest` | Docker CE version (e.g., `v24.0.6`). |
|
||||
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). |
|
||||
| `version` | String | `latest` | Docker version to use. See [inputs.version](#inputs.version). |
|
||||
| `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) |
|
||||
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
|
||||
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
||||
|
||||
### 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
|
||||
|
||||
The following outputs are available
|
||||
|
||||
| Name | Type | Description |
|
||||
|--------|--------|--------------------|
|
||||
| `sock` | String | Docker socket path |
|
||||
| Name | Type | Description |
|
||||
|--------|--------|---------------------------------------|
|
||||
| `sock` | String | Docker socket path |
|
||||
| `tcp` | String | Docker TCP address if tcp-port is set |
|
||||
|
||||
## Contributing
|
||||
|
||||
Want to contribute? Awesome! The most basic way to show your support is to star
|
||||
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
|
||||
or by making a [PayPal donation](https://www.paypal.me/crazyws) to ensure this
|
||||
journey continues indefinitely!
|
||||
|
||||
Thanks again for your support, it is much appreciated! :pray:
|
||||
Want to contribute? Awesome! You can find information about contributing to
|
||||
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
|
@ -185,6 +185,27 @@ describe('getInputs', () => {
|
||||
rootless: true,
|
||||
} 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
|
||||
} as context.Inputs
|
||||
],
|
||||
])(
|
||||
'[%d] given %p as inputs, returns %p',
|
||||
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
|
||||
|
11
action.yml
11
action.yml
@ -1,7 +1,7 @@
|
||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||
name: 'Docker Setup Docker'
|
||||
description: 'Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE'
|
||||
author: 'crazy-max'
|
||||
name: Docker Setup Docker
|
||||
description: Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE
|
||||
author: docker
|
||||
branding:
|
||||
icon: 'anchor'
|
||||
color: 'blue'
|
||||
@ -17,6 +17,9 @@ inputs:
|
||||
daemon-config:
|
||||
description: 'Docker daemon JSON configuration'
|
||||
required: false
|
||||
tcp-port:
|
||||
description: 'TCP port to expose the Docker API locally'
|
||||
required: false
|
||||
context:
|
||||
description: 'Docker context name. (default setup-docker-action)'
|
||||
required: false
|
||||
@ -32,6 +35,8 @@ inputs:
|
||||
outputs:
|
||||
sock:
|
||||
description: "Docker socket path"
|
||||
tcp:
|
||||
description: "Docker TCP address if tcp-port is set"
|
||||
|
||||
runs:
|
||||
using: 'node20'
|
||||
|
4
dist/index.js
generated
vendored
4
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
@ -15,19 +15,19 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/crazy-max/ghaction-setup-docker.git"
|
||||
"url": "git+https://github.com/docker/setup-docker-action.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"docker",
|
||||
"engine"
|
||||
],
|
||||
"author": "CrazyMax",
|
||||
"author": "Docker Inc.",
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "yarn@3.6.3",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1",
|
||||
"@docker/actions-toolkit": "^0.46.0"
|
||||
"@docker/actions-toolkit": "^0.49.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.6.0",
|
||||
|
@ -1,10 +1,13 @@
|
||||
import * as core from '@actions/core';
|
||||
import {InstallSource} from '@docker/actions-toolkit/lib/docker/install';
|
||||
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 {
|
||||
source: InstallSource;
|
||||
daemonConfig?: string;
|
||||
tcpPort?: number;
|
||||
context: string;
|
||||
setHost: boolean;
|
||||
rootless: boolean;
|
||||
@ -21,6 +24,7 @@ export function getInputs(): Inputs {
|
||||
return {
|
||||
source: source,
|
||||
daemonConfig: core.getInput('daemon-config'),
|
||||
tcpPort: Util.getInputNumber('tcp-port'),
|
||||
context: core.getInput('context'),
|
||||
setHost: core.getBooleanInput('set-host'),
|
||||
rootless: core.getBooleanInput('rootless')
|
||||
|
14
src/main.ts
14
src/main.ts
@ -19,12 +19,20 @@ actionsToolkit.run(
|
||||
throw new Error(`'default' context cannot be used.`);
|
||||
}
|
||||
|
||||
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({
|
||||
runDir: runDir,
|
||||
source: input.source,
|
||||
rootless: input.rootless,
|
||||
contextName: input.context || 'setup-docker-action',
|
||||
daemonConfig: input.daemonConfig
|
||||
daemonConfig: input.daemonConfig,
|
||||
localTCPPort: tcpPort
|
||||
});
|
||||
let toolDir;
|
||||
if (!(await Docker.isAvailable()) || input.source) {
|
||||
@ -38,6 +46,10 @@ actionsToolkit.run(
|
||||
await core.group(`Setting outputs`, async () => {
|
||||
core.info(`sock=${sockPath}`);
|
||||
core.setOutput('sock', sockPath);
|
||||
if (tcpAddress) {
|
||||
core.info(`tcp=${tcpAddress}`);
|
||||
core.setOutput('tcp', tcpAddress);
|
||||
}
|
||||
});
|
||||
|
||||
if (input.setHost) {
|
||||
|
10
yarn.lock
10
yarn.lock
@ -1102,9 +1102,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@docker/actions-toolkit@npm:^0.46.0":
|
||||
version: 0.46.0
|
||||
resolution: "@docker/actions-toolkit@npm:0.46.0"
|
||||
"@docker/actions-toolkit@npm:^0.49.0":
|
||||
version: 0.49.0
|
||||
resolution: "@docker/actions-toolkit@npm:0.49.0"
|
||||
dependencies:
|
||||
"@actions/artifact": ^2.1.11
|
||||
"@actions/cache": ^3.3.0
|
||||
@ -1127,7 +1127,7 @@ __metadata:
|
||||
semver: ^7.6.3
|
||||
tar-stream: ^3.1.7
|
||||
tmp: ^0.2.3
|
||||
checksum: cd34682d1b801c17c81f7f6791c4c81a69018f02413a1f7a7c2c1086bf0ee98c9afb5b44e6d5b8827df188819913eec47fa5b54b63f522b4a87c216de0b5725f
|
||||
checksum: 5e945601180002f129f095bba2d7d938b5ca69e87631d5e96a0d3b2254a8b034ab4bafbf7582ea82995e39610ad00fd68b34ab5875b9b314690328f714ad79d0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -3359,7 +3359,7 @@ __metadata:
|
||||
resolution: "docker-setup-docker@workspace:."
|
||||
dependencies:
|
||||
"@actions/core": ^1.11.1
|
||||
"@docker/actions-toolkit": ^0.46.0
|
||||
"@docker/actions-toolkit": ^0.49.0
|
||||
"@types/node": ^20.6.0
|
||||
"@typescript-eslint/eslint-plugin": ^6.6.0
|
||||
"@typescript-eslint/parser": ^6.6.0
|
||||
|
Reference in New Issue
Block a user