%OS_VERSION% in containerfile snippets?

Is there a way to use the release version in a containerfile snippet? For example:
modules:
- type: containerfile
snippets:
- COPY --from=ghcr.io/ublue-os/akmods:main-41 /rpms/ /tmp/rpms
- RUN find /tmp/rpms
- RUN rpm -q ublue-os-akmods-addons || rpm-ostree install /tmp/rpms/ublue-os/ublue-os-akmods*.rpm
modules:
- type: containerfile
snippets:
- COPY --from=ghcr.io/ublue-os/akmods:main-41 /rpms/ /tmp/rpms
- RUN find /tmp/rpms
- RUN rpm -q ublue-os-akmods-addons || rpm-ostree install /tmp/rpms/ublue-os/ublue-os-akmods*.rpm
instead of a specific release, I want something like:
modules:
- type: containerfile
snippets:
- COPY --from=ghcr.io/ublue-os/akmods:main-%%OS_RELEASE%% /rpms/ /tmp/rpms
- RUN find /tmp/rpms
- RUN rpm -q ublue-os-akmods-addons || rpm-ostree install /tmp/rpms/ublue-os/ublue-os-akmods*.rpm
modules:
- type: containerfile
snippets:
- COPY --from=ghcr.io/ublue-os/akmods:main-%%OS_RELEASE%% /rpms/ /tmp/rpms
- RUN find /tmp/rpms
- RUN rpm -q ublue-os-akmods-addons || rpm-ostree install /tmp/rpms/ublue-os/ublue-os-akmods*.rpm
12 Replies
xyny
xyny2mo ago
I'm not sure, but I think it might be available as an ENV var in the Containerfile, which means it'd be possible to just use it with regular Containerfile syntax Check by building the recipe into a Containerfile locally
Luke Skywunker
Luke Skywunker2mo ago
So this is actually set in the export script, which is sourced on every module call. We don't actually set it as an environment variable in the container file itself. This is mainly because we're trying to get the information from the OS release file I would instead suggest running a script snippet right after the container file module call that copy should carry over for the script call Also keep in mind that the image size will be bloated because you're copying in the RPMs For this particular issue, you might be able to just use the akmods module
fiftydinar
fiftydinar2mo ago
can't currently cover his usage (nvidia logic needs to be updated) plus he copies ublue-os config & some more stuff from ublue so it's in 1 place when looking into recipe/script but I guess that when nvidia logic gets updated (hopefully no more breaking changes), he can switch to using akmods module
RoyalOughtness
RoyalOughtnessOP2mo ago
oh right, i need to manually delete right?
Luke Skywunker
Luke Skywunker2mo ago
That won't help when you're using the copy syntax. If you delete it in a later step, the image size won't really be reduced unless you're using squash I can work on that later
RoyalOughtness
RoyalOughtnessOP2mo ago
ah i see not exactly sure what you mean
Luke Skywunker
Luke Skywunker2mo ago
If you use the script module, it will automatically set up the export so you can use OS version environment variable
RoyalOughtness
RoyalOughtnessOP2mo ago
ahh
Luke Skywunker
Luke Skywunker2mo ago
Oh wait, you're trying to use that on the copy line
RoyalOughtness
RoyalOughtnessOP2mo ago
wait shouldnt the script module come before then?
Luke Skywunker
Luke Skywunker2mo ago
I think I would have to add functionality for substitution like that for the containerfile module
RoyalOughtness
RoyalOughtnessOP2mo ago
that would be convenient, no rush though i can work around it for now
Want results from more Discord servers?
Add your server