mirror of
https://github.com/docker/setup-docker-action.git
synced 2026-03-20 08:39:47 +00:00
Compare commits
138 Commits
v3.5.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a76c65921 | ||
|
|
a37060524b | ||
|
|
d9a54c7876 | ||
|
|
4e9fc90ea1 | ||
|
|
484eb8a5aa | ||
|
|
a9a8a9dfba | ||
|
|
25e790c0aa | ||
|
|
6b9b235f7c | ||
|
|
7461c6046f | ||
|
|
da08d0c6e0 | ||
|
|
5fc00c3ecf | ||
|
|
1a6edb0ba9 | ||
|
|
1c63d0a9bc | ||
|
|
36efcb97db | ||
|
|
61e47f647f | ||
|
|
64e9804c90 | ||
|
|
ca54cb1e9e | ||
|
|
2d1c601523 | ||
|
|
87e5e87f0e | ||
|
|
c5620aed45 | ||
|
|
76747bc859 | ||
|
|
ba311ac264 | ||
|
|
817f81dc01 | ||
|
|
f524fc8e8f | ||
|
|
d628ef03a6 | ||
|
|
bd87803de9 | ||
|
|
d758fac2f6 | ||
|
|
994ca6a470 | ||
|
|
567531d87b | ||
|
|
9ba91cefb5 | ||
|
|
73dd80d85e | ||
|
|
6d927c4c13 | ||
|
|
48428700fb | ||
|
|
206b75dbd2 | ||
|
|
c5226a330b | ||
|
|
7ca7d98ba6 | ||
|
|
44cc003740 | ||
|
|
992974e691 | ||
|
|
1d3903993e | ||
|
|
dabbf8396d | ||
|
|
e43656e248 | ||
|
|
51b16473d8 | ||
|
|
34fbc53a71 | ||
|
|
ec52bdf18d | ||
|
|
c2e06996ea | ||
|
|
02a35a12bc | ||
|
|
1d30751f7d | ||
|
|
20e0c03a8d | ||
|
|
069eb67b1b | ||
|
|
c17c6939ae | ||
|
|
42e161ad30 | ||
|
|
37fd203c16 | ||
|
|
c33cda087a | ||
|
|
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 | ||
|
|
01efb57f88 | ||
|
|
f5dddcbf38 | ||
|
|
ccdfecaaf2 | ||
|
|
07f0e609c6 | ||
|
|
eff8d999dc | ||
|
|
57e629a437 | ||
|
|
5bf030df68 |
@@ -1,3 +0,0 @@
|
|||||||
/dist/**
|
|
||||||
/coverage/**
|
|
||||||
/node_modules/**
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:jest/recommended",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
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
|
## 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`
|
2. Configure and install the dependencies: `yarn install`
|
||||||
3. Create a new branch: `git checkout -b my-branch-name`
|
3. Create a new branch: `git checkout -b my-branch-name`
|
||||||
4. Make your changes
|
4. Make your changes
|
||||||
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
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`
|
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.
|
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:
|
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.
|
|
||||||
124
.github/workflows/ci.yml
vendored
124
.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'
|
||||||
@@ -159,13 +160,13 @@ jobs:
|
|||||||
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
with:
|
with:
|
||||||
driver: docker
|
driver: docker
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
push: true
|
push: true
|
||||||
@@ -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: ./
|
||||||
@@ -199,13 +199,13 @@ jobs:
|
|||||||
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
docker run -d -p 5000:5000 --restart=always --name registry registry:2
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
with:
|
with:
|
||||||
driver: docker
|
driver: docker
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
push: true
|
push: true
|
||||||
@@ -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@v7
|
||||||
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 }}
|
||||||
|
|||||||
49
.github/workflows/update-dist.yml
vendored
Normal file
49
.github/workflows/update-dist.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: update-dist
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-dist:
|
||||||
|
if: github.actor == 'dependabot[bot]'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: GitHub auth token from GitHub App
|
||||||
|
id: docker-read-app
|
||||||
|
uses: actions/create-github-app-token@v2
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.GHACTIONS_REPO_WRITE_APP_ID }}
|
||||||
|
private-key: ${{ secrets.GHACTIONS_REPO_WRITE_APP_PRIVATE_KEY }}
|
||||||
|
owner: docker
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ steps.docker-read-app.outputs.token || github.token }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@v7
|
||||||
|
with:
|
||||||
|
source: .
|
||||||
|
targets: build
|
||||||
|
-
|
||||||
|
name: Commit and push dist
|
||||||
|
run: |
|
||||||
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add dist
|
||||||
|
git commit -m "chore: update generated content"
|
||||||
|
git push
|
||||||
|
)
|
||||||
|
else
|
||||||
|
echo "No changes in dist"
|
||||||
|
fi
|
||||||
20
.github/workflows/validate.yml
vendored
20
.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 }}
|
matrix: ${{ steps.generate.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
-
|
-
|
||||||
name: Targets matrix
|
name: Generate matrix
|
||||||
id: targets
|
id: generate
|
||||||
run: |
|
uses: docker/bake-action/subaction/matrix@v7
|
||||||
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
|
||||||
@@ -33,13 +34,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
include: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v7
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|||||||
@@ -6,6 +6,5 @@
|
|||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid"
|
||||||
"parser": "typescript"
|
|
||||||
}
|
}
|
||||||
|
|||||||
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
File diff suppressed because one or more lines are too long
12
.yarnrc.yml
12
.yarnrc.yml
@@ -1,3 +1,9 @@
|
|||||||
|
# https://yarnpkg.com/configuration/yarnrc
|
||||||
|
|
||||||
|
compressionLevel: mixed
|
||||||
|
enableGlobalCache: false
|
||||||
|
enableHardenedMode: true
|
||||||
|
|
||||||
logFilters:
|
logFilters:
|
||||||
- code: YN0013
|
- code: YN0013
|
||||||
level: discard
|
level: discard
|
||||||
@@ -5,9 +11,7 @@ logFilters:
|
|||||||
level: discard
|
level: discard
|
||||||
- code: YN0076
|
- code: YN0076
|
||||||
level: discard
|
level: discard
|
||||||
|
- code: YN0086
|
||||||
|
level: discard
|
||||||
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
plugins:
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
|
||||||
|
|||||||
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/marketplace/actions/docker-setup-docker)
|
||||||
[](https://github.com/crazy-max/ghaction-setup-docker/actions?workflow=ci)
|
[](https://github.com/docker/setup-docker-action/actions?workflow=ci)
|
||||||
[](https://github.com/crazy-max/ghaction-setup-docker/actions?workflow=test)
|
[](https://github.com/docker/setup-docker-action/actions?workflow=test)
|
||||||
[](https://codecov.io/gh/crazy-max/ghaction-setup-docker)
|
[](https://codecov.io/gh/docker/setup-docker-action)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
> [!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]
|
> [!WARNING]
|
||||||
> Does not work on macOS runners with ARM architecture (no nested virtualization):
|
> 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/crazy-max/ghaction-setup-docker/pull/53
|
||||||
@@ -24,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)
|
||||||
@@ -44,7 +52,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v3
|
uses: docker/setup-docker-action@v5
|
||||||
```
|
```
|
||||||
|
|
||||||
### Daemon configuration
|
### Daemon configuration
|
||||||
@@ -66,7 +74,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v3
|
uses: docker/setup-docker-action@v5
|
||||||
with:
|
with:
|
||||||
daemon-config: |
|
daemon-config: |
|
||||||
{
|
{
|
||||||
@@ -94,7 +102,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: crazy-max/ghaction-setup-docker@v3
|
uses: docker/setup-docker-action@v5
|
||||||
env:
|
env:
|
||||||
LIMA_START_ARGS: --cpus 4 --memory 8
|
LIMA_START_ARGS: --cpus 4 --memory 8
|
||||||
```
|
```
|
||||||
@@ -106,30 +114,96 @@ 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) |
|
||||||
|
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
|
||||||
| `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. |
|
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||||
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
| `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
|
||||||
|
|
||||||
Want to contribute? Awesome! The most basic way to show your support is to star
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
|
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
|
||||||
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:
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import {beforeEach, describe, expect, test} from '@jest/globals';
|
import {beforeEach, describe, expect, test} from 'vitest';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context.js';
|
||||||
|
|
||||||
describe('getInputs', () => {
|
describe('getInputs', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -13,7 +15,7 @@ describe('getInputs', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
test.each([
|
const cases: [number, Map<string, string>, context.Inputs][] = [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
new Map<string, string>([
|
new Map<string, string>([
|
||||||
@@ -30,8 +32,10 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
@@ -52,8 +56,10 @@ 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,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
2,
|
2,
|
||||||
@@ -70,8 +76,10 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: true
|
setHost: true,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
3,
|
3,
|
||||||
@@ -90,8 +98,10 @@ 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,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
4,
|
4,
|
||||||
@@ -108,8 +118,10 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false
|
setHost: false,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
5,
|
5,
|
||||||
@@ -128,7 +140,9 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
6,
|
6,
|
||||||
@@ -147,7 +161,9 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
7,
|
7,
|
||||||
@@ -165,7 +181,9 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
8,
|
8,
|
||||||
@@ -183,10 +201,36 @@ describe('getInputs', () => {
|
|||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: true,
|
rootless: true,
|
||||||
} as context.Inputs
|
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
||||||
|
githubToken: '',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
])(
|
[
|
||||||
'[%d] given %p as inputs, returns %p',
|
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: '',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
];
|
||||||
|
test.each(cases)(
|
||||||
|
'[%d] given %o as inputs, returns %o',
|
||||||
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
|
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
|
||||||
inputs.forEach((value: string, name: string) => {
|
inputs.forEach((value: string, name: string) => {
|
||||||
setInput(name, value);
|
setInput(name, value);
|
||||||
|
|||||||
12
__tests__/setup.unit.ts
Normal file
12
__tests__/setup.unit.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import fs from 'node:fs';
|
||||||
|
import os from 'node:os';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-docker-action-'));
|
||||||
|
|
||||||
|
process.env = Object.assign({}, process.env, {
|
||||||
|
TEMP: tmpDir,
|
||||||
|
GITHUB_REPOSITORY: 'docker/setup-docker-action',
|
||||||
|
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
||||||
|
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
||||||
|
});
|
||||||
20
action.yml
20
action.yml
@@ -1,7 +1,7 @@
|
|||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
name: 'Docker Setup Docker'
|
name: Docker Setup Docker
|
||||||
description: 'Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE'
|
description: Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE
|
||||||
author: 'crazy-max'
|
author: docker
|
||||||
branding:
|
branding:
|
||||||
icon: 'anchor'
|
icon: 'anchor'
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
@@ -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,12 +31,21 @@ 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: 'node24'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
post: 'dist/index.js'
|
post: 'dist/index.js'
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG NODE_VERSION=20
|
ARG NODE_VERSION=24
|
||||||
|
|
||||||
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 rsync
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
||||||
|
set -e
|
||||||
corepack enable
|
corepack enable
|
||||||
yarn --version
|
yarn --version
|
||||||
yarn config set --home enableTelemetry 0
|
yarn config set --home enableTelemetry 0
|
||||||
@@ -27,25 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
|
|||||||
git add -A
|
git add -A
|
||||||
cp -rf /vendor/* .
|
cp -rf /vendor/* .
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
||||||
git status --porcelain -- yarn.lock
|
git status --porcelain -- yarn.lock
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=target=/context \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules <<EOT
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
set -e
|
||||||
|
rsync -a /context/. .
|
||||||
|
rm -rf dist
|
||||||
|
yarn run build
|
||||||
|
mkdir /out
|
||||||
|
cp -r dist /out
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM scratch AS build-update
|
FROM scratch AS build-update
|
||||||
COPY --from=build /out /
|
COPY --from=build /out /
|
||||||
|
|
||||||
FROM build AS build-validate
|
FROM build AS build-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=target=/context \
|
||||||
|
--mount=target=.,type=tmpfs <<EOT
|
||||||
set -e
|
set -e
|
||||||
|
rsync -a /context/. .
|
||||||
git add -A
|
git add -A
|
||||||
|
rm -rf dist
|
||||||
cp -rf /out/* .
|
cp -rf /out/* .
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||||
@@ -58,8 +68,7 @@ FROM deps AS format
|
|||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format \
|
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
|
||||||
|
|
||||||
FROM scratch AS format-update
|
FROM scratch AS format-update
|
||||||
COPY --from=format /out /
|
COPY --from=format /out /
|
||||||
@@ -74,7 +83,7 @@ FROM deps AS test
|
|||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
FROM scratch AS test-coverage
|
||||||
COPY --from=test /tmp/coverage /
|
COPY --from=test /tmp/coverage /
|
||||||
|
|||||||
105
dist/index.js
generated
vendored
105
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
2632
dist/licenses.txt
generated
vendored
2632
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
3
dist/package.json
generated
vendored
Normal file
3
dist/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
1
dist/sourcemap-register.cjs
generated
vendored
Normal file
1
dist/sourcemap-register.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/sourcemap-register.js
generated
vendored
1
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
@@ -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"]
|
||||||
|
|||||||
52
eslint.config.mjs
Normal file
52
eslint.config.mjs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import {defineConfig} from 'eslint/config';
|
||||||
|
import js from '@eslint/js';
|
||||||
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
||||||
|
import vitest from '@vitest/eslint-plugin';
|
||||||
|
import globals from 'globals';
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier/flat';
|
||||||
|
import eslintPluginPrettier from 'eslint-plugin-prettier';
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
{
|
||||||
|
ignores: ['.yarn/**/*', 'coverage/**/*', 'dist/**/*']
|
||||||
|
},
|
||||||
|
js.configs.recommended,
|
||||||
|
...tseslint.configs['flat/recommended'],
|
||||||
|
eslintConfigPrettier,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['__tests__/**'],
|
||||||
|
...vitest.configs.recommended,
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...vitest.environments.env.globals
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...vitest.configs.recommended.rules,
|
||||||
|
'vitest/no-conditional-expect': 'error',
|
||||||
|
'vitest/no-disabled-tests': 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
prettier: eslintPluginPrettier
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'@typescript-eslint/no-require-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAsImport: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import os from 'os';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-docker-action-'));
|
|
||||||
|
|
||||||
process.env = Object.assign({}, process.env, {
|
|
||||||
TEMP: tmpDir,
|
|
||||||
GITHUB_REPOSITORY: 'docker/setup-docker-action',
|
|
||||||
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
|
||||||
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
|
||||||
}) as {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
testEnvironment: 'node',
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
|
||||||
},
|
|
||||||
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
|
|
||||||
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
|
||||||
verbose: true
|
|
||||||
};
|
|
||||||
50
package.json
50
package.json
@@ -1,47 +1,45 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-setup-docker",
|
"name": "docker-setup-docker",
|
||||||
"description": "Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE",
|
"description": "Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE",
|
||||||
"main": "lib/main.js",
|
"type": "module",
|
||||||
|
"main": "src/main.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
"lint": "yarn run prettier && yarn run eslint",
|
"lint": "eslint --max-warnings=0 .",
|
||||||
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
"format": "eslint --fix .",
|
||||||
"eslint": "eslint --max-warnings=0 .",
|
"test": "vitest run",
|
||||||
"eslint:fix": "eslint --fix .",
|
|
||||||
"prettier": "prettier --check \"./**/*.ts\"",
|
|
||||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
|
||||||
"test": "jest",
|
|
||||||
"all": "yarn run build && yarn run format && yarn test"
|
"all": "yarn run build && yarn run format && yarn test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/crazy-max/ghaction-setup-docker.git"
|
"url": "git+https://github.com/docker/setup-docker-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
"docker",
|
"docker",
|
||||||
"engine"
|
"engine"
|
||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "Docker Inc.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"packageManager": "yarn@3.6.3",
|
"packageManager": "yarn@4.9.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^3.0.0",
|
||||||
"@docker/actions-toolkit": "^0.46.0"
|
"@docker/actions-toolkit": "^0.77.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.6.0",
|
"@eslint/js": "^9.39.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
"@types/node": "^24.11.0",
|
||||||
"@typescript-eslint/parser": "^6.6.0",
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
||||||
"@vercel/ncc": "^0.38.0",
|
"@typescript-eslint/parser": "^8.56.1",
|
||||||
"eslint": "^8.49.0",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"@vitest/coverage-v8": "^4.0.18",
|
||||||
"eslint-plugin-jest": "^27.2.3",
|
"@vitest/eslint-plugin": "^1.6.9",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint": "^9.39.3",
|
||||||
"jest": "^29.6.4",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"prettier": "^3.0.3",
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
"ts-jest": "^29.1.1",
|
"globals": "^17.3.0",
|
||||||
"ts-node": "^10.9.1",
|
"prettier": "^3.8.1",
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.9.3",
|
||||||
|
"vitest": "^4.0.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.js';
|
||||||
|
import {Util} from '@docker/actions-toolkit/lib/util.js';
|
||||||
|
|
||||||
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')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
54
src/main.ts
54
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.js';
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
||||||
|
import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install.js';
|
||||||
|
import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install.js';
|
||||||
|
|
||||||
import * as context from './context';
|
import * as context from './context.js';
|
||||||
import * as stateHelper from './state-helper';
|
import * as stateHelper from './state-helper.js';
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "nodenext",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"target": "es6",
|
|
||||||
"module": "commonjs",
|
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
@@ -11,9 +11,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
},
|
},
|
||||||
"exclude": [
|
"include": [
|
||||||
"node_modules",
|
"src/**/*.ts"
|
||||||
"**/*.test.ts",
|
|
||||||
"jest.config.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
16
vitest.config.ts
Normal file
16
vitest.config.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import {defineConfig} from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
clearMocks: true,
|
||||||
|
environment: 'node',
|
||||||
|
setupFiles: ['./__tests__/setup.unit.ts'],
|
||||||
|
include: ['**/*.test.ts'],
|
||||||
|
coverage: {
|
||||||
|
provider: 'v8',
|
||||||
|
reporter: ['clover'],
|
||||||
|
include: ['src/**/*.ts'],
|
||||||
|
exclude: ['src/**/main.ts']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user