Added support for multistage build cache

This commit is contained in:
Igor Alexandrov
2023-06-15 21:20:06 +04:00
parent f0301d2007
commit 4df3389d09
10 changed files with 349 additions and 60 deletions

View File

@@ -1,17 +1,32 @@
class Mrsk::Commands::Builder::Native < Mrsk::Commands::Builder::Base
def create
# No-op on native
# No-op on native without cache
if config.builder.cache?
docker :buildx, :create, "--use", "--driver=docker-container"
end
end
def remove
# No-op on native
# No-op on native without cache
if config.builder.cache?
docker :buildx, :rm, builder_name
end
end
def push
combine \
docker(:build, *build_options, build_context),
docker(:push, config.absolute_image),
docker(:push, config.latest_image)
if config.builder.cache?
docker :buildx, :build,
"--push",
*build_options,
build_context
else
combine \
docker(:build, *build_options, build_context),
docker(:push, config.absolute_image),
docker(:push, config.latest_image)
end
end
def info