Skip to content

Commit 63926b8

Browse files
Merge pull request #1 from WarpBuilds/prajjwal-warp-540
feat: adds WarpBuild Docker Builders support
2 parents 84ad562 + 1aa09e8 commit 63926b8

File tree

12 files changed

+625
-96
lines changed

12 files changed

+625
-96
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ on:
1515
description: 'BuildKit image'
1616
default: 'moby/buildkit:buildx-stable-1'
1717
required: false
18-
schedule:
19-
- cron: '0 10 * * *'
2018
push:
2119
branches:
2220
- 'master'

.github/workflows/debug.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Debug WarpBuild Docker Configure Action
2+
3+
on:
4+
push:
5+
branches:
6+
- prajjwal-warp-540
7+
8+
9+
jobs:
10+
test-multi-warp:
11+
name: Debug Run ${{ matrix.run_number }}
12+
runs-on: warp-ubuntu-latest-x64-2x
13+
strategy:
14+
matrix:
15+
run_number: [1]
16+
fail-fast: false
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Build Dockerfile in __tests__ using Buildx
22+
uses: ./
23+
with:
24+
context: .
25+
file: __tests__/Dockerfile
26+
tags: test-image-run-${{ matrix.run_number }}
27+
push: false
28+
platforms: linux/amd64,linux/arm64
29+
profile-name: test-multi-builder
30+
31+

.github/workflows/e2e.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ concurrency:
66

77
on:
88
workflow_dispatch:
9-
schedule:
10-
- cron: '0 10 * * *'
119
push:
1210
branches:
1311
- 'master'

README.md

Lines changed: 25 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
[![GitHub release](https://img.shields.io/github/release/docker/build-push-action.svg?style=flat-square)](https://github.com/docker/build-push-action/releases/latest)
2-
[![GitHub marketplace](https://img.shields.io/badge/marketplace-build--and--push--docker--images-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/build-and-push-docker-images)
3-
[![CI workflow](https://img.shields.io/github/actions/workflow/status/docker/build-push-action/ci.yml?branch=master&label=ci&logo=github&style=flat-square)](https://github.com/docker/build-push-action/actions?workflow=ci)
4-
[![Test workflow](https://img.shields.io/github/actions/workflow/status/docker/build-push-action/test.yml?branch=master&label=test&logo=github&style=flat-square)](https://github.com/docker/build-push-action/actions?workflow=test)
5-
[![Codecov](https://img.shields.io/codecov/c/github/docker/build-push-action?logo=codecov&style=flat-square)](https://codecov.io/gh/docker/build-push-action)
1+
# Build and push Docker images with WarpBuild
62

73
## About
84

9-
GitHub Action to build and push Docker images with [Buildx](https://github.com/docker/buildx)
5+
WarpBuild's fork of the `docker/build-push-action` to build and push Docker images with [Buildx](https://github.com/docker/buildx) and WarpBuild's [remote builders](https://docs.warpbuild.com/docker-builders)
106
with full support of the features provided by [Moby BuildKit](https://github.com/moby/buildkit)
117
builder toolkit. This includes multi-platform build, secrets, remote cache, etc.
128
and different builder deployment/namespacing options.
139

14-
![Screenshot](.github/build-push-action.png)
10+
![Screenshot](https://docs.warpbuild.com/assets/images/benchmarks-3494176636319a86b311a3ea11541b61.png)
1511

1612
___
1713

@@ -29,17 +25,15 @@ ___
2925

3026
## Usage
3127

32-
In the examples below we are also using 3 other actions:
28+
The usage is the same as the original `docker/build-push-action`, but with the added benefit of using powerful WarpBuild's remote docker builders.
3329

34-
* [`setup-buildx`](https://github.com/docker/setup-buildx-action) action will
35-
create and boot a builder using by default the [`docker-container` driver](https://docs.docker.com/build/building/drivers/docker-container/).
36-
This is **not required but recommended** using it to be able to build
37-
multi-platform images, export cache, etc.
38-
* [`setup-qemu`](https://github.com/docker/setup-qemu-action) action can be
39-
useful if you want to add emulation support with QEMU to be able to build
40-
against more platforms.
41-
* [`login`](https://github.com/docker/login-action) action will take care to
42-
log in against a Docker registry.
30+
> Note: We recommend to **not** use `docker/setup-buildx-action` as this action will automatically setup builders for you.
31+
32+
Additionally, this action requires an additional input called `profile-name` which is the name of the WarpBuild profile to use. Refer to the [WarpBuild documentation](https://docs.warpbuild.com/docker-builders#see-it-in-action) for more information on how to create and use profiles.
33+
34+
> Note: The `profile-name` input is required.
35+
36+
If you want to use this action on non-WarpBuild runners, you will also need to provide the `api-key` input. Learn more about creating an API key [here](https://docs.warpbuild.com/api-keys#creating-an-api-key).
4337

4438
### Git context
4539

@@ -58,7 +52,7 @@ on:
5852

5953
jobs:
6054
docker:
61-
runs-on: ubuntu-latest
55+
runs-on: warp-ubuntu-latest-x64-2x
6256
steps:
6357
-
6458
name: Login to Docker Hub
@@ -69,15 +63,13 @@ jobs:
6963
-
7064
name: Set up QEMU
7165
uses: docker/setup-qemu-action@v3
72-
-
73-
name: Set up Docker Buildx
74-
uses: docker/setup-buildx-action@v3
7566
-
7667
name: Build and push
77-
uses: docker/build-push-action@v6
68+
uses: Warpbuilds/build-push-action@v6
7869
with:
7970
push: true
8071
tags: user/app:latest
72+
profile-name: super-fast-builder
8173
```
8274
8375
Be careful because **any file mutation in the steps that precede the build step
@@ -94,11 +86,12 @@ to the default Git context:
9486
```yaml
9587
-
9688
name: Build and push
97-
uses: docker/build-push-action@v6
89+
uses: Warpbuilds/build-push-action@v6
9890
with:
9991
context: "{{defaultContext}}:mysubdir"
10092
push: true
10193
tags: user/app:latest
94+
profile-name: super-fast-builder
10295
```
10396

10497
Building from the current repository automatically uses the [GitHub Token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication),
@@ -109,10 +102,11 @@ named `GIT_AUTH_TOKEN` to be able to authenticate against it with Buildx:
109102
```yaml
110103
-
111104
name: Build and push
112-
uses: docker/build-push-action@v6
105+
uses: Warpbuilds/build-push-action@v6
113106
with:
114107
push: true
115108
tags: user/app:latest
109+
profile-name: super-fast-builder
116110
secrets: |
117111
GIT_AUTH_TOKEN=${{ secrets.MYTOKEN }}
118112
```
@@ -127,7 +121,7 @@ on:
127121
128122
jobs:
129123
docker:
130-
runs-on: ubuntu-latest
124+
runs-on: warp-ubuntu-latest-x64-2x
131125
steps:
132126
-
133127
name: Checkout
@@ -146,11 +140,12 @@ jobs:
146140
uses: docker/setup-buildx-action@v3
147141
-
148142
name: Build and push
149-
uses: docker/build-push-action@v6
143+
uses: Warpbuilds/build-push-action@v6
150144
with:
151145
context: .
152146
push: true
153147
tags: user/app:latest
148+
profile-name: super-fast-builder
154149
```
155150

156151
## Examples
@@ -173,36 +168,7 @@ jobs:
173168

174169
## Summaries
175170

176-
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
177-
that provides a detailed overview of the build execution. The summary shows an
178-
overview of all the steps executed during the build, including the build inputs
179-
and eventual errors.
180-
181-
![build-push-action job summary](./.github/build-push-summary.png)
182-
183-
The summary also includes a link for downloading the build record with
184-
additional details about the build, including build stats, logs, outputs, and
185-
more. The build record can be imported to Docker Desktop for inspecting the
186-
build in greater detail.
187-
188-
> [!WARNING]
189-
>
190-
> If you're using the [`actions/download-artifact`](https://github.com/actions/download-artifact)
191-
> action in your workflow, you need to ignore the build record artifacts
192-
> if `name` and `pattern` inputs are not specified ([defaults to download all artifacts](https://github.com/actions/download-artifact?tab=readme-ov-file#download-all-artifacts) of the workflow),
193-
> otherwise the action will fail:
194-
> ```yaml
195-
> - uses: actions/download-artifact@v4
196-
> with:
197-
> pattern: "!*.dockerbuild"
198-
> ```
199-
> More info: https://github.com/actions/toolkit/pull/1874
200-
201-
Summaries are enabled by default, but can be disabled with the
202-
`DOCKER_BUILD_SUMMARY` [environment variable](#environment-variables).
203-
204-
For more information about summaries, refer to the
205-
[documentation](https://docs.docker.com/go/build-summary/).
171+
Build summaries are not supported at the moment.
206172

207173
## Customizing
208174

@@ -227,7 +193,7 @@ The following inputs can be used as `step.with` keys:
227193
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
228194
| `allow` | List/CSV | List of [extra privileged entitlement](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow) (e.g., `network.host,security.insecure`) |
229195
| `annotations` | List | List of annotation to set to the image |
230-
| `attests` | List | List of [attestation](https://docs.docker.com/build/attestations/) parameters (e.g., `type=sbom,generator=image`) |
196+
| `attests` | List | List of [attestation](https://docs.docker.com/build/attestations/) parameters (e.g., `type=sbom,generator=image`) |
231197
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
232198
| `build-args` | List | List of [build-time variables](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-arg) |
233199
| `build-contexts` | List | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`) |
@@ -281,7 +247,6 @@ The following outputs are available:
281247

282248
See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
283249

284-
## Contributing
250+
## Support
285251

286-
Want to contribute? Awesome! You can find information about contributing to
287-
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
252+
If you need help, please reach out to us on [Email](mailto:support@warpbuild.com) or [Website](https://app.warpbuild.com).

TROUBLESHOOTING.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,20 @@ on:
4040

4141
jobs:
4242
containerd:
43-
runs-on: ubuntu-latest
43+
runs-on: warp-ubuntu-latest-x64-2x
4444
steps:
4545
-
4646
name: Checkout
4747
uses: actions/checkout@v4
4848
-
4949
name: Set up QEMU
5050
uses: docker/setup-qemu-action@v3
51-
-
52-
name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v3
54-
with:
55-
buildkitd-flags: --debug
5651
-
5752
name: Set up containerd
5853
uses: crazy-max/ghaction-setup-containerd@v2
5954
-
6055
name: Build Docker image
61-
uses: docker/build-push-action@v6
56+
uses: Warpbuilds/build-push-action@v6
6257
with:
6358
context: .
6459
platforms: linux/amd64,linux/arm64
@@ -111,10 +106,11 @@ to generate sanitized tags:
111106
tags: latest
112107
113108
- name: Build and push
114-
uses: docker/build-push-action@v6
109+
uses: Warpbuilds/build-push-action@v6
115110
with:
116111
context: .
117112
push: true
113+
profile-name: super-fast-builder
118114
tags: ${{ steps.meta.outputs.tags }}
119115
```
120116

@@ -129,9 +125,10 @@ Or a dedicated step to sanitize the slug:
129125
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
130126
131127
- name: Build and push
132-
uses: docker/build-push-action@v6
128+
uses: Warpbuilds/build-push-action@v6
133129
with:
134130
context: .
135131
push: true
132+
profile-name: super-fast-builder
136133
tags: ${{ steps.repo_slug.outputs.result }}:latest
137134
```

__tests__/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.11-slim
2+
3+
RUN apt-get update && apt-get install -y \
4+
curl \
5+
&& rm -rf /var/lib/apt/lists/*
6+
7+
CMD ["python3", "--version"]

action.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
2-
name: Build and push Docker images
3-
description: Build and push Docker images with Buildx
4-
author: docker
1+
name: Build and push Docker images with WarpBuild
2+
description: Build and push Docker images with Buildx and WarpBuild's remote builders
3+
author: WarpBuilds
54
branding:
6-
icon: 'anchor'
5+
icon: 'cpu'
76
color: 'blue'
87

98
inputs:
@@ -112,6 +111,17 @@ inputs:
112111
default: ${{ github.token }}
113112
required: false
114113

114+
api-key:
115+
description: "The API key for the WarpBuild API. This is not required in case of using WarpBuild runners"
116+
required: false
117+
profile-name:
118+
description: "The profile name to use for the WarpBuild Docker Builders"
119+
required: true
120+
timeout:
121+
description: "The timeout(in ms) to wait for the Docker Builders to be ready. By default, it is 5 minutes"
122+
required: false
123+
default: "300000"
124+
115125
outputs:
116126
imageid:
117127
description: 'Image ID'

dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export interface Inputs {
4141
target: string;
4242
ulimit: string[];
4343
'github-token': string;
44+
apiKey: string;
45+
profileName: string;
46+
timeout: string;
4447
}
4548

4649
export async function getInputs(): Promise<Inputs> {
@@ -77,7 +80,10 @@ export async function getInputs(): Promise<Inputs> {
7780
tags: Util.getInputList('tags'),
7881
target: core.getInput('target'),
7982
ulimit: Util.getInputList('ulimit', {ignoreComma: true}),
80-
'github-token': core.getInput('github-token')
83+
'github-token': core.getInput('github-token'),
84+
apiKey: core.getInput('api-key'),
85+
profileName: core.getInput('profile-name'),
86+
timeout: core.getInput('timeout')
8187
};
8288
}
8389

0 commit comments

Comments
 (0)