mirror of
https://github.com/docker/build-push-action.git
synced 2025-06-14 07:07:12 +02:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a531fa5a6 | |||
565d16e074 | |||
c473874c2c | |||
b94cedd686 | |||
76c8b42a58 | |||
920f0da143 | |||
e723b420bf | |||
f9deaa080c | |||
b4c22c3e33 | |||
a8587cb818 | |||
f2a733f179 | |||
35ab0dd217 | |||
46d5afd128 | |||
a8bb35be5a | |||
5c278cd8ab | |||
3b98ff3c03 | |||
6b88c3e647 | |||
0db984c182 | |||
35e3637576 | |||
a29353b5c7 | |||
241c03788f | |||
a6ea296fed | |||
13137a8f9b | |||
22b2fa68fc | |||
9ada3141a9 | |||
e53bafea73 | |||
b9335d6c83 | |||
d51711af0d | |||
b0a38c7db9 |
34
.github/labels.yml
vendored
34
.github/labels.yml
vendored
@ -68,7 +68,6 @@
|
||||
name: ":question: question"
|
||||
color: "3f51b5"
|
||||
description: ""
|
||||
from_name: "question"
|
||||
- # upstream
|
||||
name: ":eyes: upstream"
|
||||
color: "fbca04"
|
||||
@ -77,3 +76,36 @@
|
||||
name: ":coffin: wontfix"
|
||||
color: "ffffff"
|
||||
description: ""
|
||||
|
||||
- # registry-aws-ecr
|
||||
name: "registry-aws-ecr"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-azure-acr
|
||||
name: "registry-azure-acr"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-dockerhub
|
||||
name: "registry-dockerhub"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-github
|
||||
name: "registry-github"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-google-gar
|
||||
name: "registry-google-gar"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-google-gcr
|
||||
name: "registry-google-gcr"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-nexus
|
||||
name: "registry-nexus"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
- # registry-quay
|
||||
name: "registry-quay"
|
||||
color: "84858A"
|
||||
description: ""
|
||||
|
22
.github/workflows/e2e.yml
vendored
22
.github/workflows/e2e.yml
vendored
@ -32,6 +32,26 @@ jobs:
|
||||
slug: registry.gitlab.com/test1716/test
|
||||
username_secret: GITLAB_USERNAME
|
||||
password_secret: GITLAB_TOKEN
|
||||
-
|
||||
registry: 175142243308.dkr.ecr.us-east-2.amazonaws.com
|
||||
slug: 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action
|
||||
username_secret: AWS_ACCESS_KEY_ID
|
||||
password_secret: AWS_SECRET_ACCESS_KEY
|
||||
-
|
||||
registry: public.ecr.aws
|
||||
slug: public.ecr.aws/q3b5f1u4/test-docker-action
|
||||
username_secret: AWS_ACCESS_KEY_ID
|
||||
password_secret: AWS_SECRET_ACCESS_KEY
|
||||
-
|
||||
registry: us-east4-docker.pkg.dev
|
||||
slug: us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action
|
||||
username_secret: GAR_USERNAME
|
||||
password_secret: GAR_JSON_KEY
|
||||
-
|
||||
registry: gcr.io
|
||||
slug: gcr.io/sandbox-298914/test-docker-action
|
||||
username_secret: GCR_USERNAME
|
||||
password_secret: GCR_JSON_KEY
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
@ -66,6 +86,8 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ matrix.slug }}:master
|
||||
cache-to: type=inline
|
||||
-
|
||||
name: Inspect image
|
||||
if: github.event_name != 'pull_request'
|
||||
|
16
README.md
16
README.md
@ -9,7 +9,7 @@
|
||||
`v2` of this action includes significant updates and now uses Docker [Buildx](https://github.com/docker/buildx). It
|
||||
works with 3 new actions ([login](https://github.com/docker/login-action), [setup-buildx](https://github.com/docker/setup-buildx-action)
|
||||
and [setup-qemu](https://github.com/docker/setup-qemu-action)) that we have created. It's also rewritten as a
|
||||
[typescript-action](https://github.com/actions/typescript-action/) to be as closed as possible of the
|
||||
[typescript-action](https://github.com/actions/typescript-action/) to be as close as possible of the
|
||||
[GitHub Runner](https://github.com/actions/virtual-environments) during its execution.
|
||||
|
||||
[Upgrade notes](UPGRADE.md) and many [usage examples](#usage) have been added to handle most use cases but `v1` is
|
||||
@ -35,7 +35,7 @@ ___
|
||||
* [Multi-platform image](#multi-platform-image)
|
||||
* [Advanced usage](#advanced-usage)
|
||||
* [Push to multi-registries](#push-to-multi-registries)
|
||||
* [Cache to registry](#push-to-multi-registries)
|
||||
* [Cache to registry](#cache-to-registry)
|
||||
* [Local registry](#local-registry)
|
||||
* [Export image to Docker](#export-image-to-docker)
|
||||
* [Leverage GitHub cache](#leverage-github-cache)
|
||||
@ -59,8 +59,8 @@ build-secrets, remote cache, etc. and different builder deployment/namespacing o
|
||||
|
||||
### Git context
|
||||
|
||||
The default behavior of this action is to use the [Git context invoked](https://github.com/docker/build-push-action/blob/master/src/context.ts#L31-L35)
|
||||
by your workflow.
|
||||
The default behavior of this action is to use the Git context invoked by your workflow.
|
||||
(eg. `https://github.com/<owner>/<repo>.git#<ref>`)
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
@ -116,8 +116,8 @@ repository, you have to use a secret named `GIT_AUTH_TOKEN` to be able to authen
|
||||
GIT_AUTH_TOKEN=${{ secrets.MYTOKEN }}
|
||||
```
|
||||
|
||||
> :warning: Subdir for Git context is [not yet supported](https://github.com/docker/build-push-action/issues/120).
|
||||
> For the moment you can use the [path context](#path-context).
|
||||
> :warning: Subdir for Git context is not yet supported ([moby/buildkit#1684](https://github.com/moby/buildkit/issues/1684))
|
||||
> but you can use the [path context](#path-context) in the meantime.
|
||||
|
||||
> More info: https://docs.docker.com/engine/reference/commandline/build/#git-repositories
|
||||
|
||||
@ -608,7 +608,7 @@ Following inputs can be used as `step.with` keys
|
||||
|---------------------|----------|------------------------------------|
|
||||
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
||||
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
|
||||
| `file` | String | Path to the Dockerfile (default `./Dockerfile`) |
|
||||
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
|
||||
| `build-args` | List | List of build-time variables |
|
||||
| `labels` | List | List of metadata for an image |
|
||||
| `tags` | List/CSV | List of tags |
|
||||
@ -651,6 +651,7 @@ secrets: |
|
||||
|
||||
bbbb
|
||||
ccc"
|
||||
"JSON_SECRET={""key1"":""value1"",""key2"":""value2""}"
|
||||
```
|
||||
|
||||
| Key | Value |
|
||||
@ -660,6 +661,7 @@ secrets: |
|
||||
| `MYSECRET` | `aaaaaaaa\nbbbbbbb\nccccccccc` |
|
||||
| `FOO` | `bar` |
|
||||
| `EMPTYLINE` | `aaaa\n\nbbbb\nccc` |
|
||||
| `JSON_SECRET` | `{"key1":"value1","key2":"value2"}` |
|
||||
|
||||
> Note: all quote signs need to be doubled for escaping.
|
||||
|
||||
|
@ -147,7 +147,6 @@ describe('getArgs', () => {
|
||||
'buildx',
|
||||
'build',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'--file', 'Dockerfile',
|
||||
'.'
|
||||
]
|
||||
],
|
||||
@ -162,7 +161,20 @@ describe('getArgs', () => {
|
||||
'--build-arg', 'MY_ARG=val1,val2,val3',
|
||||
'--build-arg', 'ARG=val',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'--file', 'Dockerfile',
|
||||
'https://github.com/docker/build-push-action.git#test-jest'
|
||||
]
|
||||
],
|
||||
[
|
||||
'0.4.2',
|
||||
new Map<string, string>([
|
||||
['tags', 'name/app:7.4, name/app:latest'],
|
||||
]),
|
||||
[
|
||||
'buildx',
|
||||
'build',
|
||||
'--tag', 'name/app:7.4',
|
||||
'--tag', 'name/app:latest',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'https://github.com/docker/build-push-action.git#test-jest'
|
||||
]
|
||||
],
|
||||
@ -179,7 +191,6 @@ describe('getArgs', () => {
|
||||
'--label', 'org.opencontainers.image.title=buildkit',
|
||||
'--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit',
|
||||
'--output', 'type=local,dest=./release-out',
|
||||
'--file', 'Dockerfile',
|
||||
'.'
|
||||
]
|
||||
],
|
||||
@ -193,7 +204,6 @@ describe('getArgs', () => {
|
||||
'buildx',
|
||||
'build',
|
||||
'--platform', 'linux/amd64,linux/arm64',
|
||||
'--file', 'Dockerfile',
|
||||
'.'
|
||||
]
|
||||
],
|
||||
@ -206,7 +216,6 @@ describe('getArgs', () => {
|
||||
'buildx',
|
||||
'build',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'--file', 'Dockerfile',
|
||||
'.'
|
||||
]
|
||||
],
|
||||
@ -221,7 +230,6 @@ describe('getArgs', () => {
|
||||
'build',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
|
||||
'--file', 'Dockerfile',
|
||||
'.'
|
||||
]
|
||||
],
|
||||
@ -236,7 +244,6 @@ describe('getArgs', () => {
|
||||
'build',
|
||||
'--output', '.',
|
||||
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
|
||||
'--file', 'Dockerfile',
|
||||
'https://github.com/docker/build-push-action.git#test-jest'
|
||||
]
|
||||
],
|
||||
|
@ -16,7 +16,6 @@ inputs:
|
||||
file:
|
||||
description: "Path to the Dockerfile"
|
||||
required: false
|
||||
default: './Dockerfile'
|
||||
build-args:
|
||||
description: "List of build-time variables"
|
||||
required: false
|
||||
|
979
dist/index.js
generated
vendored
979
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -31,8 +31,8 @@
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/github": "^4.0.0",
|
||||
"csv-parse": "^4.14.1",
|
||||
"semver": "^7.3.2",
|
||||
"csv-parse": "^4.14.2",
|
||||
"semver": "^7.3.4",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -57,7 +57,7 @@ export function tmpNameSync(options?: tmp.TmpNameOptions): string {
|
||||
export async function getInputs(defaultContext: string): Promise<Inputs> {
|
||||
return {
|
||||
context: core.getInput('context') || defaultContext,
|
||||
file: core.getInput('file') || 'Dockerfile',
|
||||
file: core.getInput('file'),
|
||||
buildArgs: await getInputList('build-args', true),
|
||||
labels: await getInputList('labels', true),
|
||||
tags: await getInputList('tags'),
|
||||
@ -183,7 +183,7 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
|
||||
res.push(output.join(','));
|
||||
}
|
||||
|
||||
return res.filter(item => item);
|
||||
return res.filter(item => item).map(pat => pat.trim());
|
||||
}
|
||||
|
||||
export const asyncForEach = async (array, callback) => {
|
||||
|
30
yarn.lock
30
yarn.lock
@ -1236,10 +1236,10 @@ cssstyle@^2.2.0:
|
||||
dependencies:
|
||||
cssom "~0.3.6"
|
||||
|
||||
csv-parse@*, csv-parse@^4.14.1:
|
||||
version "4.14.1"
|
||||
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.14.1.tgz#b6b3736508fb94682fa6d450fe1755237221d291"
|
||||
integrity sha512-4wmcO7QbWtDAncGFaBwlWFPhEN4Akr64IbM4zvDwEOFekI8blLc04Nw7XjQjtSNy+3AUAgBgtUa9nWo5Cq89Xg==
|
||||
csv-parse@*, csv-parse@^4.14.2:
|
||||
version "4.14.2"
|
||||
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.14.2.tgz#c1329cff95a99b8773a92c4e62f8bff114b34726"
|
||||
integrity sha512-YE2xlTKtM035/94llhgsp9qFQxGi47EkQJ1pZ+mLT/98GpIsbjkMGAb7Rmu9hNxVfYFOLf10hP+rPVqnoccLgw==
|
||||
|
||||
dashdash@^1.12.0:
|
||||
version "1.14.1"
|
||||
@ -2614,6 +2614,13 @@ lru-cache@^4.1.5:
|
||||
pseudomap "^1.0.2"
|
||||
yallist "^2.1.2"
|
||||
|
||||
lru-cache@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
||||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
make-dir@^3.0.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
|
||||
@ -3236,10 +3243,12 @@ saxes@^5.0.0:
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||
|
||||
semver@7.x, semver@^7.3.2:
|
||||
version "7.3.2"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
|
||||
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
|
||||
semver@7.x, semver@^7.3.2, semver@^7.3.4:
|
||||
version "7.3.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97"
|
||||
integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^6.0.0, semver@^6.3.0:
|
||||
version "6.3.0"
|
||||
@ -3895,6 +3904,11 @@ yallist@^2.1.2:
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
|
||||
|
||||
yallist@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
||||
|
||||
yargs-parser@18.x, yargs-parser@^18.1.2:
|
||||
version "18.1.3"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||
|
Reference in New Issue
Block a user