Skip to content

Commit

Permalink
Merge pull request #21539 from crazy-max/gha-docker-login
Browse files Browse the repository at this point in the history
gha: move docker login step up
  • Loading branch information
dvdksn authored Dec 1, 2024
2 parents a65dac8 + e6d3d21 commit c650b54
Show file tree
Hide file tree
Showing 32 changed files with 223 additions and 198 deletions.
11 changes: 5 additions & 6 deletions content/guides/bun/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@ to Docker Hub.
build:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand Down
2 changes: 2 additions & 0 deletions content/guides/cpp/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
3 changes: 3 additions & 0 deletions content/guides/dotnet/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test
uses: docker/build-push-action@v6
with:
target: build
load: true

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
2 changes: 2 additions & 0 deletions content/guides/golang/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
3 changes: 3 additions & 0 deletions content/guides/java/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test
uses: docker/build-push-action@v6
with:
target: test
load: true

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
5 changes: 4 additions & 1 deletion content/guides/nodejs/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,20 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test
uses: docker/build-push-action@v6
with:
target: test
load: true

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64/v8
platforms: linux/amd64,linux/arm64
push: true
target: prod
tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest
Expand Down
3 changes: 3 additions & 0 deletions content/guides/php/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and test
uses: docker/build-push-action@v6
with:
target: test
load: true

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
2 changes: 2 additions & 0 deletions content/guides/python/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
2 changes: 2 additions & 0 deletions content/guides/r/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
3 changes: 2 additions & 1 deletion content/guides/ruby/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: true
tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest
```
Expand Down
2 changes: 2 additions & 0 deletions content/guides/rust/configure-ci-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ to Docker Hub.
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
4 changes: 3 additions & 1 deletion content/manuals/build-cloud/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "<ORG>/default"
install: true

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
3 changes: 1 addition & 2 deletions content/manuals/build/bake/remote-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ remote definition and the local "metadata-only" Bake file, specify both files
and use the `cwd://` prefix for the metadata Bake file:

```yml
-
name: Build
- name: Build
uses: docker/bake-action@v4
with:
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
Expand Down
8 changes: 4 additions & 4 deletions content/manuals/build/cache/optimize.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down
22 changes: 10 additions & 12 deletions content/manuals/build/ci/github-actions/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
Expand Down Expand Up @@ -170,17 +169,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
Expand Down
18 changes: 9 additions & 9 deletions content/manuals/build/ci/github-actions/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -75,14 +75,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata
id: meta
Expand Down Expand Up @@ -128,14 +128,14 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
Expand Down
12 changes: 6 additions & 6 deletions content/manuals/build/ci/github-actions/attestations.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata
id: meta
Expand Down Expand Up @@ -108,15 +108,15 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
Expand Down
10 changes: 4 additions & 6 deletions content/manuals/build/ci/github-actions/build-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ select the item in the list.
To disable job summaries, set the `DOCKER_BUILD_SUMMARY` environment variable
in the YAML configuration for your build step:

```yaml {hl_lines=5}
-
name: Build
```yaml {hl_lines=4}
- name: Build
uses: docker/docker-build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
Expand All @@ -86,9 +85,8 @@ To disable the upload of the build record archive to GitHub, set the
`DOCKER_BUILD_RECORD_UPLOAD` environment variable in the YAML configuration for
your build step:

```yaml {hl_lines=5}
-
name: Build
```yaml {hl_lines=4}
- name: Build
uses: docker/docker-build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
Expand Down
Loading

0 comments on commit c650b54

Please sign in to comment.