-
Notifications
You must be signed in to change notification settings - Fork 33
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: Allow users to bring their own Dockerfile #773
base: main
Are you sure you want to change the base?
Conversation
if opts.Dockerfile != "" { | ||
fmt.Fprint(h, opts.Dockerfile) | ||
} | ||
if opts.BuildCtxObject != "" { | ||
fmt.Fprint(h, opts.BuildCtxObject) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels pretty hacky to me, but I don't think we can change hash body.
@@ -25,7 +25,7 @@ FROM base AS build | |||
|
|||
WORKDIR /workspace | |||
|
|||
RUN apt-get install -y libfuse3-dev && \ | |||
RUN apt-get install -y libfuse3-dev libbtrfs-dev libgpgme-dev && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there may have been an issue with libgpg + cedana, we should look into if it causes any issues with C/R
@@ -93,6 +115,11 @@ RUN apt-get install -y --no-install-recommends nvidia-container-toolkit-base nvi | |||
|
|||
RUN apt-get update && apt-get install -y fuse3 libfuse2 libfuse3-dev libfuse-dev bash-completion | |||
|
|||
RUN apt-get install -y libbtrfs-dev libgpgme11-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
fmt.Fprintf(&b, " \"ExistingImageUri\": %q,", o.ExistingImageUri) | ||
fmt.Fprintf(&b, " \"ExistingImageCreds\": %#v,", o.ExistingImageCreds) | ||
fmt.Fprintf(&b, " \"Dockerfile\": %q,", o.Dockerfile) | ||
fmt.Fprintf(&b, " \"BuildCtxObject\": %q,", o.BuildCtxObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is in this var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The object ID of the synced build context directory
pkg/abstractions/image/build.go
Outdated
@@ -201,6 +263,8 @@ func (b *Builder) Build(ctx context.Context, opts *BuildOpts, outputChan chan co | |||
ImageId: baseImageId, | |||
SourceImage: &sourceImage, | |||
SourceImageCreds: opts.BaseImageCreds, | |||
Dockerfile: dockerfile, | |||
BuildCtxObject: &opts.BuildCtxObject, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like that this is top level on the ContainerRequest. It might seem out of scope but I think we should nest these under a BuildOptions struct on the container request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped it out
pkg/types/scheduler.go
Outdated
@@ -101,6 +111,16 @@ func (c *ContainerRequest) RequiresGPU() bool { | |||
return len(c.GpuRequest) > 0 || c.Gpu != "" | |||
} | |||
|
|||
func (c *ContainerRequest) ImageSourceType() ImageSourceType { | |||
if c.Dockerfile != nil { | |||
return ImageSourceTypeBuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably would call this just ImageSource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I'd rather it be a method on a BuildOptions struct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also already have an isBuildRequest thing so it's more fitting under that struct IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just removed this entirely as I don't think it was really needed
pkg/worker/lifecycle.go
Outdated
if err != nil { | ||
return err | ||
switch request.ImageSourceType() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think after moving this to the build options struct, it would be cleaner to refactor this to first check if it's a build request using the container ID, etc. And then handle these clauses in a separate function so it's logically separate from the standard container execution flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Resolve BE-2084
This feature adds a new operator to the
Image
abstraction that allows users to specify a path to a Dockerfile that they wish to use as the base of their Image. We usebuildah
andumoci
to build their Dockerfile and gather the bundle needed to run it.It can be used as follows:
Where
./Dockerfile
is:Note: when testing locally, you might need to build gateway again to get
make start
to work because the go version is bumped.