-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Stages #173
feat: Stages #173
Conversation
…un_module script to source exports
In my mind I was initially critical of this feature, since it would be more efficient to just build a new container image for the "stage", as this approach rebuilds the stage every day. But as users seem delighted, and caching will make it better, I guess it's good. It's always optional, too. Most of our modules aren't designed to be used in stages, and would probably produce odd results there. I guess I should work on structuring the docs for modules better wrt that soon. |
Yeah, I was thinking that we could just mention that not all modules will work oob with every build image and we make no guarantees. The script and files modules are good examples of modules that are still very useful for stages though.
Yeah I'm going to be using this to compile the latest versions of some of my favorite programs rather than having to compile them every so often locally. |
Can't review this now, would be nice to get a corresponding docs PR before merge. |
Sure, I can get that out later today. |
Aight, thanks. I just read the docs, and there are still a couple things that require discussion IMO. First of all, are we sure it's a good idea to include a collection of setup scripts needed for the modules for different distributions, as there's an infinite amount of distributions, and not all modules are intended to be used in stages... Would it be best to just supply a package list required for most modules, to not have a growing list of scripts to maintain, and not imply official support for some distros in stages over others? Also, the stage configuration has an overlapping set of top-level keys with the recipe itself, but the And one thing I noticed, which is not related to this PR, is |
I think we should support the base types of modules just so that use of stages is similar to the final image. I don't think it's out of the question to make sure a few tools are installed. The way we check for the package manager could probably be adjusted to instead check for the program rather than
Yeah I originally was trying to follow a similar pattern with it being |
If we need to, we could copy |
We copy in |
…or-things-like-compiled-programs
…or-things-like-compiled-programs
…or-things-like-compiled-programs
Doing some testing with this made me find out the buildah/podman currently doesn't support the |
…or-things-like-compiled-programs
…or-things-like-compiled-programs
…or-things-like-compiled-programs
Stages
A new property (
stages
) is being added to the recipe file schema. This property will allow users to define a list of Containerfile stages each with their own modules. Stages can be used to compile programs, perform parallel operations, and copy the results into the final image without contaminating the final image.Module Support
Currently the only modules that work out-of-the-box are
copy
,script
,files
, andcontainerfile
. Other modules are dependent on the programs installed on the image. In order to better support some of our essential modules, a setup script is ran at the start of each stage that is notscratch
. This script will installcurl
,wget
,bash
, andgrep
and use the package manager for the detected distributions.At this time, the following distributions are supported:
Contributions to increase the size of this list is welcome!
Syntax
from
- The full image ref (image name + tag). This will be set in theFROM
statement of the stage.name
- The name of the stage. This is used when referencing the stage when using thefrom:
property in thecopy
module.modules
- The list of modules to execute. The exact same syntax used by the main recipemodules:
property.shell
- Allows a user to pass in an array of strings that are passed directly into theSHELL
instruction.Example
Tasks
from-file:
- Allows the user to store their stages in a separate file so it can be included in multiple recipesno-cache:
- This will be useful for stages that want to pull the latest changes from a git repo and not have to rely on the base image getting an update for the build to be triggered again.bluebuild
modules in stagescopy
moduleThis is a 1-1 for the
COPY
instruction. It has the ability to copy files between stages, making this a very important addition to complete functionality for the stages feature. Each use of this "module" will become its own layer.Syntax
src
- The source directory/file from the repo OR whenfrom:
is set the image/stage that is specified.dest
- The destination directory/file inside the working image.from
- The stage/image to copy from.Example
Tasks
from:
optionalFeature gating
Gating this feature until we release for
v0.9.0
. The plan will be to build all features (including this one) for main branch builds. This means that these features will be available when using themain
image and consequently theuse_unstable_cli:
option on the GitHub Action. All futurev0.9.0
features will be gated as well to allow for patches tov0.8
.Tasks
--all-features
on non-tagged builds