[英]How can I save the build result of the Github Actions docker image
Is it possible to save the build of the Github action so that it does not download this action the next time, then the problem is that I created an action that collects php with certain settings and everything is in the docker image, it takes about 2 minutes to beat the date image, which is a lot, since in subsequent executions, it makes no sense to rebuild the whole image and use the result of the build of this image.是否可以保存 Github 操作的构建,以便下次它不会下载此操作,那么问题是我创建了一个操作,该操作通过某些设置收集 php 并且所有内容都在 Z05B6053C41A2130AFD6Z imageFC3B16 中分钟来击败日期图像,这很多,因为在随后的执行中,重建整个图像并使用该图像的构建结果是没有意义的。
Is there some way to cache it or save this docker build of the file somewhere?有没有办法缓存它或将这个 docker 构建的文件保存在某处?
You can use the native caching - GitHub has an action for this: https://github.com/actions/cache .您可以使用本机缓存 - GitHub 对此有一个操作: https://github.com/actions/cache 。
You'd place this caching step before your build step.您可以将此缓存步骤放在构建步骤之前。
Essentially you'd create a key from a hash of a file (eg a manifest file) or directory.本质上,您将从文件(例如清单文件)或目录的 hash 创建一个密钥。 Then, the Cache action would check if that key matches the key of the cache.
然后,缓存操作将检查该键是否与缓存的键匹配。 If it matches, the cache is reloaded.
如果匹配,则重新加载缓存。 If it doesn't match, then in your build step, you'd include an
if
directive with something like steps.build-cache.outputs.cache-hit != 'true'
to ensure that the build step only runs if the cache is invalid.如果不匹配,那么在您的构建步骤中,您将包含一个
if
指令,其中包含类似steps.build-cache.outputs.cache-hit != 'true'
内容,以确保构建步骤仅在缓存时运行是无效的。
The docker-layer-caching
action is built on actions/cache
, and can be used to cache separate build layers of your Docker container. docker-layer-caching
操作建立在actions/cache
之上,可用于缓存 Docker 容器的单独构建层。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.