Skip to content

Commit 22eced2

Browse files
authored
docs: Recommend ECR instead of GHA for buildx caching, update README using cloudposse/build-harness (#61)
## what * Recommend ECR instead of GHA for buildx caching ## why * ECR remote caching is more appropriate in an AWS environment, as it can lead to better performance (and potentially lower costs if an ECR VPC endpoint is used in conjunction with hosted GHA runners). ## references * https://aws.amazon.com/blogs/containers/announcing-remote-cache-support-in-amazon-ecr-for-buildkit-clients/
1 parent dd2a28d commit 22eced2

File tree

3 files changed

+71
-162
lines changed

3 files changed

+71
-162
lines changed

README.md

Lines changed: 54 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11

2+
23
<!-- markdownlint-disable -->
3-
# github-action-docker-build-push [![Latest Release](https://img.shields.io/github/release/cloudposse/github-action-docker-build-push.svg)](https://github.com/cloudposse/github-action-docker-build-push/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
4+
# github-action-docker-build-push <a href="https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content="><img align="right" src="https://cloudposse.com/logo-300x69.svg" width="150" /></a>
5+
<a href="https://github.com/cloudposse/github-action-docker-build-push/releases/latest"><img src="https://img.shields.io/github/release/cloudposse/github-action-docker-build-push.svg" alt="Latest Release"/></a><a href="https://slack.cloudposse.com"><img src="https://slack.cloudposse.com/badge.svg" alt="Slack Community"/></a>
46
<!-- markdownlint-restore -->
57

6-
[![README Header][readme_header_img]][readme_header_link]
7-
8-
[![Cloud Posse][logo]](https://cpco.io/homepage)
9-
108
<!--
119
1210
1311
1412
1513
** DO NOT EDIT THIS FILE
1614
**
17-
** This file was automatically generated by the `build-harness`.
15+
** This file was automatically generated by the `cloudposse/build-harness`.
1816
** 1) Make all changes to `README.yaml`
1917
** 2) Run `make init` (you only need to do this once)
2018
** 3) Run`make readme` to rebuild this file.
@@ -30,29 +28,6 @@
3028

3129
Build Docker image and push it
3230

33-
---
34-
35-
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
36-
[<img align="right" title="Share via Email" src="https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg"/>][share_email]
37-
[<img align="right" title="Share on Google+" src="https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg" />][share_googleplus]
38-
[<img align="right" title="Share on Facebook" src="https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg" />][share_facebook]
39-
[<img align="right" title="Share on Reddit" src="https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg" />][share_reddit]
40-
[<img align="right" title="Share on LinkedIn" src="https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg" />][share_linkedin]
41-
[<img align="right" title="Share on Twitter" src="https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg" />][share_twitter]
42-
43-
44-
45-
46-
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
47-
48-
49-
50-
51-
52-
53-
54-
55-
5631

5732

5833

@@ -63,11 +38,8 @@ Build Docker image and push it.
6338

6439

6540

66-
6741
## Usage
6842

69-
70-
7143
```yaml
7244
name: Push into main branch
7345
on:
@@ -96,6 +68,21 @@ Build Docker image and push it.
9668
image: ${{ steps.build.outputs.image }}
9769
tag: ${{ steps.build.outputs.tag }}
9870
```
71+
> [!TIP]
72+
> If omitted, `cache-from` and `cache-to` will default to `gha`.
73+
> In an AWS environment, we recommend using [ECR as a remote cache](https://aws.amazon.com/blogs/containers/announcing-remote-cache-support-in-amazon-ecr-for-buildkit-clients/).
74+
75+
```diff
76+
- name: Build
77+
id: build
78+
uses: cloudposse/github-action-docker-build-push@main
79+
with:
80+
registry: registry.hub.docker.com
81+
organization: "${{ github.event.repository.owner.login }}"
82+
repository: "${{ github.event.repository.name }}"
83+
+ cache-from: "type=registry,ref=registry.hub.docker.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:cache"
84+
+ cache-to: "mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=registry.hub.docker.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:cache"
85+
```
9986

10087

10188

@@ -111,9 +98,11 @@ Build Docker image and push it.
11198
| build-args | List of build-time variables | N/A | false |
11299
| cache-from | List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir) | type=gha | false |
113100
| cache-to | List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir) | type=gha,mode=max | false |
101+
| docker-metadata-pr-head-sha | Set to `true` to tag images with the PR HEAD SHA instead of the merge commit SHA within pull requests. | false | false |
114102
| file | Dockerfile name | Dockerfile | false |
115103
| image\_name | Image name (excluding registry). Defaults to {{$organization/$repository}}. | | false |
116104
| login | Docker login | | false |
105+
| no-cache | Send the --no-cache flag to the docker build process | false | false |
117106
| organization | Organization | N/A | true |
118107
| password | Docker password | | false |
119108
| platforms | List of target platforms for build (e.g. linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,etc) | linux/amd64 | false |
@@ -138,15 +127,6 @@ Build Docker image and push it.
138127
<!-- markdownlint-restore -->
139128

140129

141-
142-
## Share the Love
143-
144-
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/github-action-docker-build-push)! (it helps us **a lot**)
145-
146-
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
147-
148-
149-
150130
## Related Projects
151131

152132
Check out these related projects.
@@ -161,86 +141,55 @@ For additional context, refer to some of these links.
161141
- [example-github-action-release-workflow](https://github.com/cloudposse/example-github-action-release-workflow) - Example application with complicated release workflow
162142

163143

164-
## Help
165-
166-
**Got a question?** We got answers.
167-
168-
File a GitHub [issue](https://github.com/cloudposse/github-action-docker-build-push/issues), send us an [email][email] or join our [Slack Community][slack].
169-
170-
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
171-
172-
## DevOps Accelerator for Startups
173-
174144

175-
We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
176145

177-
[![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support]
146+
## ✨ Contributing
178147

179-
Work directly with our team of DevOps experts via email, slack, and video conferencing.
148+
This project is under active development, and we encourage contributions from our community.
180149

181-
We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
182150

183-
- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
184-
- **Release Engineering.** You'll have end-to-end CI/CD with unlimited staging environments.
185-
- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.
186-
- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.
187-
- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.
188-
- **Training.** You'll receive hands-on training so your team can operate what we build.
189-
- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.
190-
- **Troubleshooting.** You'll get help to triage when things aren't working.
191-
- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
192-
- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.
193151

194-
## Slack Community
152+
Many thanks to our outstanding contributors:
195153

196-
Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
154+
<a href="https://github.com/cloudposse/github-action-docker-build-push/graphs/contributors">
155+
<img src="https://contrib.rocks/image?repo=cloudposse/github-action-docker-build-push&max=24" />
156+
</a>
197157

198-
## Discourse Forums
199-
200-
Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.
201-
202-
## Newsletter
203-
204-
Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
205-
206-
## Office Hours
207-
208-
[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!
209-
210-
[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]
211-
212-
## Contributing
213-
214-
### Bug Reports & Feature Requests
215-
216-
Please use the [issue tracker](https://github.com/cloudposse/github-action-docker-build-push/issues) to report any bugs or file feature requests.
217-
218-
### Developing
219-
220-
If you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email].
158+
For 🐛 bug reports & feature requests, please use the [issue tracker](https://github.com/cloudposse/github-action-docker-build-push/issues).
221159

222160
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
223-
224-
1. **Fork** the repo on GitHub
225-
2. **Clone** the project to your own machine
226-
3. **Commit** changes to your own branch
227-
4. **Push** your work back up to your fork
228-
5. Submit a **Pull Request** so that we can review your changes
161+
1. Review our [Code of Conduct](https://github.com/cloudposse/github-action-docker-build-push/?tab=coc-ov-file#code-of-conduct) and [Contributor Guidelines](https://github.com/cloudposse/.github/blob/main/CONTRIBUTING.md).
162+
2. **Fork** the repo on GitHub
163+
3. **Clone** the project to your own machine
164+
4. **Commit** changes to your own branch
165+
5. **Push** your work back up to your fork
166+
6. Submit a **Pull Request** so that we can review your changes
229167

230168
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!
231169

170+
### 🌎 Slack Community
232171

233-
## Copyright
172+
Join our [Open Source Community](https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=slack) on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
234173

235-
Copyright © 2017-2023 [Cloud Posse, LLC](https://cpco.io/copyright)
174+
### 📰 Newsletter
236175

176+
Sign up for [our newsletter](https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=newsletter) and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know.
177+
Dropped straight into your Inbox every week — and usually a 5-minute read.
237178

179+
### 📆 Office Hours <a href="https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=office_hours"><img src="https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png" align="right" /></a>
238180

181+
[Join us every Wednesday via Zoom](https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=office_hours) for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a _live Q&A_ that you can’t find anywhere else.
182+
It's **FREE** for everyone!
239183
## License
240184

241-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
185+
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge" alt="License"></a>
186+
187+
<details>
188+
<summary>Preamble to the Apache License, Version 2.0</summary>
189+
<br/>
190+
<br/>
242191

243-
See [LICENSE](LICENSE) for full details.
192+
Complete license is available in the [`LICENSE`](LICENSE) file.
244193

245194
```text
246195
Licensed to the Apache Software Foundation (ASF) under one
@@ -260,74 +209,17 @@ KIND, either express or implied. See the License for the
260209
specific language governing permissions and limitations
261210
under the License.
262211
```
263-
264-
265-
266-
267-
268-
269-
270-
212+
</details>
271213

272214
## Trademarks
273215

274216
All other trademarks referenced herein are the property of their respective owners.
275217

276-
## About
277-
278-
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!
279-
280-
[![Cloud Posse][logo]][website]
281-
282-
We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source].
283-
284-
We offer [paid support][commercial_support] on all of our projects.
285218

286-
Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
287-
288-
289-
290-
### Contributors
219+
---
220+
Copyright © 2017-2024 [Cloud Posse, LLC](https://cpco.io/copyright)
291221

292-
<!-- markdownlint-disable -->
293-
| [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] |
294-
|---|
295-
<!-- markdownlint-restore -->
296222

297-
[goruha_homepage]: https://github.com/goruha
298-
[goruha_avatar]: https://img.cloudposse.com/150x150/https://github.com/goruha.png
223+
<a href="https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=readme_footer_link"><img alt="README footer" src="https://cloudposse.com/readme/footer/img"/></a>
299224

300-
[![README Footer][readme_footer_img]][readme_footer_link]
301-
[![Beacon][beacon]][website]
302-
<!-- markdownlint-disable -->
303-
[logo]: https://cloudposse.com/logo-300x69.svg
304-
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=docs
305-
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=website
306-
[github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=github
307-
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=jobs
308-
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=hire
309-
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=slack
310-
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=linkedin
311-
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=twitter
312-
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=testimonial
313-
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=office_hours
314-
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=newsletter
315-
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=discourse
316-
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=email
317-
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=commercial_support
318-
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=we_love_open_source
319-
[terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=terraform_modules
320-
[readme_header_img]: https://cloudposse.com/readme/header/img
321-
[readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=readme_header_link
322-
[readme_footer_img]: https://cloudposse.com/readme/footer/img
323-
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=readme_footer_link
324-
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
325-
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-docker-build-push&utm_content=readme_commercial_support_link
326-
[share_twitter]: https://twitter.com/intent/tweet/?text=github-action-docker-build-push&url=https://github.com/cloudposse/github-action-docker-build-push
327-
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=github-action-docker-build-push&url=https://github.com/cloudposse/github-action-docker-build-push
328-
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/github-action-docker-build-push
329-
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/github-action-docker-build-push
330-
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/github-action-docker-build-push
331-
[share_email]: mailto:?subject=github-action-docker-build-push&body=https://github.com/cloudposse/github-action-docker-build-push
332-
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/github-action-docker-build-push?pixel&cs=github&cm=readme&an=github-action-docker-build-push
333-
<!-- markdownlint-restore -->
225+
<img alt="Beacon" width="0" src="https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/github-action-docker-build-push?pixel&cs=github&cm=readme&an=github-action-docker-build-push"/>

README.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ usage: |-
7575
image: ${{ steps.build.outputs.image }}
7676
tag: ${{ steps.build.outputs.tag }}
7777
```
78+
> [!TIP]
79+
> If omitted, `cache-from` and `cache-to` will default to `gha`.
80+
> In an AWS environment, we recommend using [ECR as a remote cache](https://aws.amazon.com/blogs/containers/announcing-remote-cache-support-in-amazon-ecr-for-buildkit-clients/).
81+
82+
```diff
83+
- name: Build
84+
id: build
85+
uses: cloudposse/github-action-docker-build-push@main
86+
with:
87+
registry: registry.hub.docker.com
88+
organization: "${{ github.event.repository.owner.login }}"
89+
repository: "${{ github.event.repository.name }}"
90+
+ cache-from: "type=registry,ref=registry.hub.docker.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:cache"
91+
+ cache-to: "mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=registry.hub.docker.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:cache"
92+
```
7893
7994
include:
8095
- "docs/github-action.md"

0 commit comments

Comments
 (0)