https://blue-build.org/ logo
%OS_VERSION% in containerfile snippets?
# questions
r
Is there a way to use the release version in a containerfile snippet? For example:
Copy code
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:
Copy code
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
a
message has been deleted
x
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
g
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
f
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
r
oh right, i need to manually delete right?
g
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
r
ah i see
not exactly sure what you mean
g
If you use the script module, it will automatically set up the export so you can use OS version environment variable
r
ahh
g
Oh wait, you're trying to use that on the copy line
r
wait shouldnt the script module come before then?
g
I think I would have to add functionality for substitution like that for the containerfile module
r
that would be convenient, no rush though i can work around it for now
2 Views