-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example using GHA cache backend (#12)
* Add caching example * edit workflow * Format * Set up buildx * Test gha cache * Tidy up * Enable containerd image store --------- Co-authored-by: Rhys Madigan <[email protected]> Co-authored-by: Rhys Madigan <[email protected]>
- Loading branch information
1 parent
40e2c12
commit ec47248
Showing
7 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright 2022 Pants project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
docker_image( | ||
name="with-gha-cache-backend", | ||
cache_to={"type": "gha", "mode": "max"}, | ||
cache_from={"type": "gha"}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 | ||
|
||
RUN echo "hello" > msg.txt && \ | ||
sleep 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Note that multistage buildx builds requires using the containerd image store, due to | ||
# limitations with the docker-container driver (https://github.com/moby/buildkit/issues/2343) | ||
|
||
docker_image( | ||
name="multiplatform-base", | ||
source="Dockerfile.base", | ||
skip_push=True, | ||
build_platform=["linux/amd64", "linux/arm64"], | ||
) | ||
|
||
docker_image( | ||
name="multiplatform-final", | ||
source="Dockerfile.final", | ||
build_platform=["linux/amd64", "linux/arm64"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM python:3.8 | ||
|
||
RUN echo "base image" >> base.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ARG PARENT=:multiplatform-base | ||
# hadolint ignore=DL3006 | ||
FROM ${PARENT} | ||
|
||
RUN cat base.txt && \ | ||
echo "final image" >> final.txt |