Skip to content

Commit f97d6e2

Browse files
authored
Merge pull request #700 from crazy-max/update-docs
docs: update links and layout
2 parents 48888e0 + 47c00d7 commit f97d6e2

26 files changed

+197
-169
lines changed

.github/workflows/ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,29 @@ jobs:
302302
run: |
303303
docker image inspect myimage:latest
304304
305+
secret:
306+
runs-on: ubuntu-latest
307+
steps:
308+
-
309+
name: Checkout
310+
uses: actions/checkout@v3
311+
-
312+
name: Set up Docker Buildx
313+
uses: docker/setup-buildx-action@v2
314+
with:
315+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
316+
driver-opts: |
317+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
318+
-
319+
name: Build
320+
uses: ./
321+
with:
322+
context: .
323+
file: ./test/secret.Dockerfile
324+
secrets: |
325+
MYSECRET=foo
326+
INVALID_SECRET=
327+
305328
network:
306329
runs-on: ubuntu-latest
307330
steps:

README.md

+58-65
Large diffs are not rendered by default.

TROUBLESHOOTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ While pushing to a registry, you may encounter these kinds of issues:
1616
* `unexpected response: 401 Unauthorized`
1717

1818
These issues are not directly related to this action but are rather linked to
19-
[buildx](https://github.com/docker/buildx), [buildkit](https://github.com/moby/buildkit),
19+
[Buildx](https://github.com/docker/buildx), [BuildKit](https://github.com/moby/buildkit),
2020
[containerd](https://github.com/containerd/containerd) or the registry on which
2121
you're pushing your image. The quality of error message depends on the registry
2222
and are usually not very informative.
@@ -29,7 +29,7 @@ action step and attach BuildKit container logs to your issue.
2929
### With containerd
3030

3131
Next you can test pushing with [containerd action](https://github.com/crazy-max/ghaction-setup-containerd)
32-
using the following workflow. If it works then open an issue on [buildkit](https://github.com/moby/buildkit)
32+
using the following workflow. If it works then open an issue on [BuildKit](https://github.com/moby/buildkit)
3333
repository.
3434

3535
```yaml

__tests__/buildx.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ describe('getSecret', () => {
137137
}
138138
expect(true).toBe(!invalid);
139139
expect(secret).toEqual(`id=${exKey},src=${tmpNameSync}`);
140-
const secretValue = await fs.readFileSync(tmpNameSync, 'utf-8');
141-
expect(secretValue).toEqual(exValue);
140+
expect(fs.readFileSync(tmpNameSync, 'utf-8')).toEqual(exValue);
142141
} catch (err) {
143142
// eslint-disable-next-line jest/no-conditional-expect
144143
expect(true).toBe(invalid);

dev.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.4
1+
# syntax=docker/dockerfile:1
22

33
ARG NODE_VERSION=16
44
ARG DOCKER_VERSION=20.10.13

docs/advanced/cache.md

+27-20
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
* [Cache backend API](#cache-backend-api)
77
* [Local cache](#local-cache)
88

9-
> More info about cache on [BuildKit](https://github.com/moby/buildkit#export-cache) and [Buildx](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) repositories.
9+
> **Note**
10+
>
11+
> See [our guide](https://github.com/docker/buildx/blob/master/docs/guides/cache/index.md)
12+
> for more details about cache storage backends.
1013
1114
## Inline cache
1215

13-
In most cases you want to use the [`type=inline` cache exporter](https://github.com/moby/buildkit#inline-push-image-and-cache-together).
16+
In most cases you want to use the [`type=inline` cache exporter](https://github.com/docker/buildx/blob/master/docs/guides/cache/inline.md).
1417
However, note that the `inline` cache exporter only supports `min` cache mode. To enable `max` cache mode, push the
1518
image and the cache separately by using the `registry` cache exporter as shown in the [next example](#registry-cache).
1619

@@ -33,7 +36,7 @@ jobs:
3336
name: Set up Docker Buildx
3437
uses: docker/setup-buildx-action@v2
3538
-
36-
name: Login to DockerHub
39+
name: Login to Docker Hub
3740
uses: docker/login-action@v2
3841
with:
3942
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -52,7 +55,7 @@ jobs:
5255
## Registry cache
5356
5457
You can import/export cache from a cache manifest or (special) image configuration on the registry with the
55-
[`type=registry` cache exporter](https://github.com/moby/buildkit/tree/master#registry-push-image-and-cache-separately).
58+
[`type=registry` cache exporter](https://github.com/docker/buildx/blob/master/docs/guides/cache/registry.md).
5659

5760
```yaml
5861
name: ci
@@ -73,7 +76,7 @@ jobs:
7376
name: Set up Docker Buildx
7477
uses: docker/setup-buildx-action@v2
7578
-
76-
name: Login to DockerHub
79+
name: Login to Docker Hub
7780
uses: docker/login-action@v2
7881
with:
7982
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -93,15 +96,17 @@ jobs:
9396

9497
### Cache backend API
9598

96-
> :test_tube: This cache exporter is considered EXPERIMENTAL until further notice. Please provide feedback on
97-
> [BuildKit repository](https://github.com/moby/buildkit) if you encounter any issues.
98-
99-
Since [buildx 0.6.0](https://github.com/docker/buildx/releases/tag/v0.6.0) and [BuildKit 0.9.0](https://github.com/moby/buildkit/releases/tag/v0.9.0),
100-
you can use the [`type=gha` cache exporter](https://github.com/moby/buildkit/tree/master#github-actions-cache-experimental).
101-
102-
GitHub Actions cache exporter backend uses the [GitHub Cache API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md)
103-
to fetch and upload cache blobs. That's why this type of cache should be exclusively used in a GitHub Action workflow
104-
as the `url` (`$ACTIONS_CACHE_URL`) and `token` (`$ACTIONS_RUNTIME_TOKEN`) attributes are populated when a workflow
99+
> **Warning**
100+
>
101+
> This cache exporter is considered EXPERIMENTAL until further notice. Please
102+
> provide feedback on [BuildKit repository](https://github.com/moby/buildkit)
103+
> if you encounter any issues.
104+
105+
[GitHub Actions cache exporter](https://github.com/docker/buildx/blob/master/docs/guides/cache/gha.md)
106+
backend uses the [GitHub Cache API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md)
107+
to fetch and upload cache blobs. That's why this type of cache should be
108+
exclusively used in a GitHub Action workflow as the `url` (`$ACTIONS_CACHE_URL`)
109+
and `token` (`$ACTIONS_RUNTIME_TOKEN`) attributes are populated when a workflow
105110
is started.
106111

107112
```yaml
@@ -123,7 +128,7 @@ jobs:
123128
name: Set up Docker Buildx
124129
uses: docker/setup-buildx-action@v2
125130
-
126-
name: Login to DockerHub
131+
name: Login to Docker Hub
127132
uses: docker/login-action@v2
128133
with:
129134
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -141,11 +146,13 @@ jobs:
141146

142147
### Local cache
143148

144-
> :warning: At the moment caches are copied over the existing cache so it [keeps growing](https://github.com/docker/build-push-action/issues/252).
145-
> The `Move cache` step is used as a temporary fix (see https://github.com/moby/buildkit/issues/1896).
149+
> **Warning**
150+
>
151+
> At the moment caches are copied over the existing cache, so it [keeps growing](https://github.com/docker/build-push-action/issues/252).
152+
> The `Move cache` step is used as a workaround (see [moby/buildkit#1896](https://github.com/moby/buildkit/issues/1896) for more info).
146153

147-
You can also leverage [GitHub cache](https://docs.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)
148-
using [actions/cache](https://github.com/actions/cache) and [`type=local` cache exporter](https://github.com/moby/buildkit#local-directory-1)
154+
You can also leverage [GitHub cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows)
155+
using the [actions/cache](https://github.com/actions/cache) and [`type=local` cache exporter](https://github.com/docker/buildx/blob/master/docs/guides/cache/local.md)
149156
with this action:
150157

151158
```yaml
@@ -175,7 +182,7 @@ jobs:
175182
restore-keys: |
176183
${{ runner.os }}-buildx-
177184
-
178-
name: Login to DockerHub
185+
name: Login to Docker Hub
179186
uses: docker/login-action@v2
180187
with:
181188
username: ${{ secrets.DOCKERHUB_USERNAME }}
+14-29
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Copy images between registries
22

3-
Multi-platform images built using buildx can be copied from one registry to another without
4-
changing the image SHA using the [tag-push-action](https://github.com/akhilerm/tag-push-action).
5-
6-
The following workflow will first push the image to dockerhub, run some tests using the images
7-
and then push to quay and ghcr
3+
[Multi-platform images](https://docs.docker.com/build/building/multi-platform/)
4+
built using Buildx can be copied from one registry to another using the
5+
[`imagetools create` command](https://docs.docker.com/engine/reference/commandline/buildx_imagetools_create/):
86

97
```yaml
108
name: ci
@@ -27,26 +25,19 @@ jobs:
2725
-
2826
name: Set up Docker Buildx
2927
uses: docker/setup-buildx-action@v2
30-
- # quay and ghcr logins for pushing image after testing
31-
name: Login to Quay Registry
28+
-
29+
name: Login to Docker Hub
3230
uses: docker/login-action@v2
3331
with:
34-
registry: quay.io
35-
username: ${{ secrets.QUAY_USERNAME }}
36-
password: ${{ secrets.QUAY_TOKEN }}
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
3734
-
3835
name: Login to GitHub Container Registry
3936
uses: docker/login-action@v2
4037
with:
4138
registry: ghcr.io
4239
username: ${{ github.repository_owner }}
4340
password: ${{ secrets.GITHUB_TOKEN }}
44-
-
45-
name: Login to DockerHub
46-
uses: docker/login-action@v2
47-
with:
48-
username: ${{ secrets.DOCKERHUB_USERNAME }}
49-
password: ${{ secrets.DOCKERHUB_TOKEN }}
5041
-
5142
name: Build and push
5243
uses: docker/build-push-action@v3
@@ -57,17 +48,11 @@ jobs:
5748
tags: |
5849
user/app:latest
5950
user/app:1.0.0
60-
- # run tests using image from docker hub
61-
name: Run Tests
62-
run: make tests
63-
- # copy multiplatform image from dockerhub to quay and ghcr
64-
name: Push Image to multiple registries
65-
uses: akhilerm/[email protected]
66-
with:
67-
src: docker.io/user/app:1.0.0
68-
dst: |
69-
quay.io/user/app:latest
70-
quay.io/user/app:1.0.0
71-
ghcr.io/user/app:latest
72-
ghcr.io/user/app:1.0.0
51+
-
52+
name: Push image to GHCR
53+
run: |
54+
docker buildx imagetools create \
55+
--tag ghcr.io/user/app:latest \
56+
--tag ghcr.io/user/app:1.0.0 \
57+
user/app:latest
7358
```

docs/advanced/dockerhub-desc.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Update DockerHub repo description
1+
# Update Docker Hub repo description
22

3-
You can update the [DockerHub repository description](https://docs.docker.com/docker-hub/repos/) using
4-
a third party action called [DockerHub Description](https://github.com/peter-evans/dockerhub-description)
3+
You can update the [Docker Hub repository description](https://docs.docker.com/docker-hub/repos/)
4+
using a third party action called [Docker Hub Description](https://github.com/peter-evans/dockerhub-description)
55
with this action:
66

77
```yaml
@@ -26,7 +26,7 @@ jobs:
2626
name: Set up Docker Buildx
2727
uses: docker/setup-buildx-action@v2
2828
-
29-
name: Login to DockerHub
29+
name: Login to Docker Hub
3030
uses: docker/login-action@v2
3131
with:
3232
username: ${{ secrets.DOCKERHUB_USERNAME }}

docs/advanced/local-registry.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Local registry
22

3-
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into:
3+
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry)
4+
to push images into:
45

56
```yaml
67
name: ci

docs/advanced/multi-platform.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Multi-platform image
22

3-
You can build multi-platform images using the [`platforms` input](../../README.md#inputs) as described below.
3+
You can build [multi-platform images](https://docs.docker.com/build/building/multi-platform/)
4+
using the [`platforms` input](../../README.md#inputs) as described below.
45

5-
> :bulb: List of available platforms will be displayed and available through our [setup-buildx](https://github.com/docker/setup-buildx-action#about) action.
6-
7-
> :bulb: If you want support for more platforms, you can use QEMU with our [setup-qemu](https://github.com/docker/setup-qemu-action) action.
6+
> **Note**
7+
>
8+
> * List of available platforms will be displayed and available through our
9+
> [setup-buildx](https://github.com/docker/setup-buildx-action#about) action.
10+
> * If you want support for more platforms, you can use QEMU with our
11+
> [setup-qemu](https://github.com/docker/setup-qemu-action) action.
812
913
```yaml
1014
name: ci
@@ -28,7 +32,7 @@ jobs:
2832
name: Set up Docker Buildx
2933
uses: docker/setup-buildx-action@v2
3034
-
31-
name: Login to DockerHub
35+
name: Login to Docker Hub
3236
uses: docker/login-action@v2
3337
with:
3438
username: ${{ secrets.DOCKERHUB_USERNAME }}

docs/advanced/named-contexts.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Dockerfile defines a stage with the same name it is overwritten.
77
This can be useful with GitHub Actions to reuse results from other builds or
88
pin an image to a spcific tag in your workflow.
99

10+
* [Pin image to a specific tag](#pin-image-to-a-specific-tag)
11+
* [Usage of the built image in other build steps](#usage-of-the-built-image-in-other-build-steps)
12+
1013
## Pin image to a specific tag
1114

1215
Replace `alpine:latest` with a pinned one:

docs/advanced/push-multi-registries.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Push to multi-registries
22

3-
* [Docker Hub and GHCR](#docker-hub-and-ghcr)
4-
5-
## Docker Hub and GHCR
6-
7-
The following workflow will connect you to [DockerHub](https://github.com/docker/login-action#dockerhub)
8-
and [GitHub Container Registry](https://github.com/docker/login-action#github-container-registry) and push the
9-
image to these registries.
3+
The following workflow will connect you to [Docker Hub](https://github.com/docker/login-action#dockerhub)
4+
and [GitHub Container Registry](https://github.com/docker/login-action#github-container-registry)
5+
and push the image to these registries:
106

117
```yaml
128
name: ci
@@ -30,7 +26,7 @@ jobs:
3026
name: Set up Docker Buildx
3127
uses: docker/setup-buildx-action@v2
3228
-
33-
name: Login to DockerHub
29+
name: Login to Docker Hub
3430
uses: docker/login-action@v2
3531
with:
3632
username: ${{ secrets.DOCKERHUB_USERNAME }}

0 commit comments

Comments
 (0)