Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Layer expression that creates no layers #201

Open
mechtaev opened this issue Apr 7, 2022 · 5 comments
Open

Layer expression that creates no layers #201

mechtaev opened this issue Apr 7, 2022 · 5 comments
Labels

Comments

@mechtaev
Copy link
Collaborator

mechtaev commented Apr 7, 2022

We can consider providing a predicate that creates an empty layer, say empty_layer or skip:

install_dependencies("debian:bullseye-slim") :- run("apt-get install iproute2").
install_dependencies("debian:bullseye") :- skip.

A concrete use case is here: https://github.com/modus-continens/openjdk-images-case-study/blob/fa02585eac8676b69918ad0dc53976be33ab29b4/linux.Modusfile#L59

@maowtm
Copy link
Contributor

maowtm commented Apr 7, 2022

Actually for that we just need something that acts like a layer expression but creates no layer, rather than introducing redundant layers in the image. Maybe we can just make a skip predicate that the build planner just carries any parent node forward

@mechtaev
Copy link
Collaborator Author

mechtaev commented Apr 7, 2022

Yes, by saying "empty layer" I meant no layers, sorry for not being precise.

@mechtaev mechtaev changed the title Creating empty layers Layer expression that creates no layers Apr 7, 2022
@thevirtuoso1973
Copy link
Contributor

Is there a use case for run("") - an actual empty layer?
If not, maybe just default to this behaviour whenever we see run("").

@thevirtuoso1973
Copy link
Contributor

thevirtuoso1973 commented Apr 7, 2022

e.g.

FROM alpine
RUN []

I could be wrong but it does seem that RUN [] does not produce a layer.

@mechtaev
Copy link
Collaborator Author

mechtaev commented Apr 7, 2022

I tried runnig

FROM alpine
RUN []
RUN sleep 1s

and then

FROM alpine
RUN sleep 1s

The sleep command was not cached, so seems like it still creates a layer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants