cache
buildkit
Our great sponsors
cache | buildkit | |
---|---|---|
40 | 52 | |
4,201 | 7,592 | |
2.4% | 2.1% | |
7.4 | 9.8 | |
6 days ago | 8 days ago | |
TypeScript | Go | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cache
-
GitHub Actions could be so much better
> with no persistent storage
There's https://github.com/actions/cache though?
-
Optimizing GitHub Actions Performance: Enhance Workflows with Caching
Use Cache Actions: GitHub Actions provides cache actions that simplify caching implementation. The @actions/cache JavaScript library is a popular choice for managing caching in workflows. It offers flexible options for storing and retrieving cache artifacts based on keys, scopes, and paths.
-
Speeding up GitHub Actions with npm cache
GitHub maintain a set of repos called actions. One of which is called cache.
-
How I Sliced Deployment Times to a Fraction and Achieved Lightning-Fast Deployments with GitHub Actions
By utilizing the actions/cache action action, we implemented a strategy to store and retrieve dependencies, preventing redundant installations.
-
Use GitHub Actions to Make Your GitHub Profile Dynamic
I do think it's good practice to enable caching, such that your script doesn't hit RubyGems / pip / npm / etc every time it runs.
That way at least the automation activity stays entirely within the GitHub / Azure network.
It looks like you can do that for Ruby by adding this:
https://github.com/actions/cache/blob/master/examples.md#rub...
- uses: ruby/setup-ruby@v1
-
A guide to using act with GitHub Actions
โ getting-started-with-act git:(master) act -j build WARN โ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. โ [Node.js CI/build] ๐ Start image=node:16-buster-slim [Node.js CI/build] ๐ณ docker pull image=node:16-buster-slim platform= username= forcePull=false [Node.js CI/build] ๐ณ docker create image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] ๐ณ docker run image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] โ git clone 'https://github.com/actions/setup-node' # ref=v3 [Node.js CI/build] โ git clone 'https://github.com/actions/cache' # ref=v3 [Node.js CI/build] โ git clone 'https://github.com/actions/upload-artifact' # ref=v3 [Node.js CI/build] โญ Run Main actions/checkout@v3 [Node.js CI/build] ๐ณ docker cp src=/Users/andrewevans/Documents/projects/getting-started-with-act/. dst=/Users/andrewevans/Documents/projects/getting-started-with-act [Node.js CI/build] โ Success - Main actions/checkout@v3 [Node.js CI/build] โญ Run Main Use Node.js 16.x [Node.js CI/build] ๐ณ docker cp src=/Users/andrewevans/.cache/act/actions-setup-node@v3/ dst=/var/run/act/actions/actions-setup-node@v3/ [Node.js CI/build] ๐ณ docker exec cmd=[node /var/run/act/actions/actions-setup-node@v3/dist/setup/index.js] user= workdir= [Node.js CI/build] ๐ฌ ::debug::isExplicit: [Node.js CI/build] ๐ฌ ::debug::explicit? false
- duplicated cache by cache action
-
runner image with MS office installed - do-able? is there a better way?
You could try to find some point in the process where you can set up Actions caches with actions/cache, otherwise Container customization for Self-Hosted Runners is currently in Beta.
-
[Question] Decrease Docker image's build time
I would configure Github Actions cache so Docker doesn't have to compile all layers from scratch every time
-
The strongest principle of the blog's growth lies in the human choice to deploy it
In the copied example, npm caching is done via actions/cache@v2 action. But we can simplify our workflow by dropping this step and using built-in functionality for caching
buildkit
-
The worst thing about Jenkins is that it works
> We are uding docker-in-docker at the moment
You can also run a "less privileged" container with all the features of Docker by using rootless buildkit in Kubernetes. Here are some examples:
https://github.com/moby/buildkit/tree/master/examples/kubern...
https://github.com/moby/buildkit/blob/master/examples/kubern...
It's also possible to run dedicated buildkitd workers and connect to them remotely.
- macOS Containers v0.0.1
-
Jenkins Agents On Kubernetes
Now since Kubernetes works off of containerd I'll be taking a different approach on handling container builds by using nerdctl and the buildkit that comes bundled with it. I'll do this on the amd64 control plane node since it's beefier than my Raspberry Pi workers for handling builds and build related services. Go ahead and download and unpack the latest nerdctl release as of writing (make sure to check the release page in case there's a new one):
-
Cicada - CI/CD platform written with Rust
Yeah, only Linux containers at the moment, BuildKit is the way we are constructing pipelines and doing caching. Split on if we will support non-linux hosts, but definitely want to find a good solution to not doing Docker-in-Docker.
-
Better support of Docker layer caching in Cargo
Relevant issues are https://github.com/moby/buildkit/issues/3011 and https://github.com/moby/buildkit/issues/1512.
-
DockerHub replacement stratagy and options
If you notice, the same thing I noticed in this list is that most of these are workarounds to support the web2 api on IPFS. There is a pull in draft for BuildKit that may make native IPFS image support better on the image build side. With the work on the nerdctl side being the most direct support for images for pushing and pulling images with IPFS hashes.
-
Why I joined Dagger
Last year I joined Dagger after realizing we were trying to solve all of the same problems (escaping YAML hell, unifying CI and dev workflows, minimizing CI overhead โ more on all that later). We were even using the same underlying technology (Buildkit) and running into all of the same challenges.
-
Rails on Docker ยท Fly
How would you do this in a generic, reusable way company-wide? Given that you don't know the targets beforehand, the names, or even the number of stages.
It is of course possible to do for a single project with a bit of effort: build each stage with a remote OCI cache source, push the cash there after. But... that sucks.
What you want is the `max` cache type in buildkit[1]. Except... not much supports that yet. The native S3 cache would also be good once it stabalizes.
I know those questions are probably rhetorical, but to answer them anyway:
> > Nice syntax
> Is it though?
The most common alternative is to use a backslash at the end of each line, to create a line continuation. This swallows the newline, so you also need a semicolon. Forgetting the semicolon leads to weird errors. Also, while Docker supports comments interspersed with line continuations, sh doesn't, so if such a command contains comments it can't be copied into sh.
There heredoc syntax doesn't have any of these issues; I think it is infinitely better.
(There is also JSON-style syntax, but it requires all backslashes to be doubled and is less popular.)
*In practice "&&" is normally used rather than ";" in order to stop the build if any command fails (otherwise sh only propagates the exit status of the last command). This is actually a small footgun with the heredoc syntax, because it is tempting to just use a newline (equivalent to a semicolon). The programmer must remember to type "&&" after each command, or use `set -e` at the start of the RUN command, or use `SHELL ["/bin/sh", "-e", "-c"]` at the top of the Dockerfile. Sigh...
> Are the line breaks semantic, or is it all a multiline string?
The line breaks are preserved ("what you see is what you get").
> Is EOF a special end-of-file token
You can choose which token to use (EOF is a common convention, but any token can be used). The text right after the "<<" indicates which token you've chosen, and the heredoc is terminated by the first line that contains just that token.
This allows you to easily create a heredoc containing other heredocs. Can you think of any other quoting syntax that allows that? (Lisp's quote form comes to mind.)
> Where is it documented?
The introduction blog post has already been linked. The reference documentation (https://github.com/moby/buildkit/blob/master/frontend/docker...) mentions but doesn't have a formal specification (unfortunately this is a wider problem for Dockerfiles, see https://supercontainers.github.io/containers-wg/ideas/docker... instead it links to the sh syntax (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...), on which the Dockerfile heredoc syntax is based.
(Good luck looking up this syntax if you don't know what it's called. But that's the same for most punctuation-based syntax.)
Unfortunately this syntax is not generally supported yet - it's only supported with the buildkit backend and only landed in the 1.3 "labs" release. It was moved to stable in early 2022 (see https://github.com/moby/buildkit/issues/2574), so that seems to be better, but I think may still require a syntax directive to enable.
Many other dockerfile build tools still don't support it, e.g. buildah (see https://github.com/containers/buildah/issues/3474)
Useful now if you have control over the environment your images are being built in, but I'm excited to the future where it's commonplace!
What are some alternatives?
buildah - A tool that facilitates building OCI images.
kaniko - Build Container Images In Kubernetes
upload-artifact
jib - ๐ Build container images for your Java applications.
buildx - Docker CLI plugin for extended build capabilities with BuildKit
podman - Podman: A tool for managing OCI containers and pods.
nerdctl - contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
sccache - Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
amazon-ecr-login - Logs into Amazon ECR with the local Docker client.
act - Run your GitHub Actions locally ๐
actions-runner-controller - Kubernetes controller for GitHub Actions self-hosted runners
setup-buildx-action - GitHub Action to set up Docker Buildx