Skip to content
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

✨ Move Earthly logic into Dockerfiles #2008

Merged
merged 35 commits into from
Nov 30, 2023

Conversation

mauromorales
Copy link
Member

Fixes #1897

@mauromorales mauromorales self-assigned this Nov 16, 2023
@mauromorales mauromorales force-pushed the 1897-full-kairos-Dockerfile branch 2 times, most recently from 85d279a to d10ef9d Compare November 27, 2023 13:25
@mauromorales
Copy link
Member Author

I cannot test the Nvidia image, but I've uploaded it here to quay.io/mauromorales/ubuntu:20.04-core-arm64-nvidia-jetson-agx-orin-v2.4.2-33-gbdd8615-dirty-img and @mudler will help me test

@@ -338,15 +338,5 @@
"baseImage": "rockylinux:9",
"arch": "amd64",
"worker": "self-hosted"
},
{
"family": "nvidia",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it from the flavors because this one is no longer a family/distribution of its own but instead it uses the ubuntu family via the BYOI. See image-arm.yaml and release.yaml to see how the two work together

@@ -57,6 +57,84 @@ jobs:
# end of optional handling for multi line json
echo "::set-output name=matrix::{\"include\": $content }"

build-nvidia-base:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nvidia base image will only be built if its dockerfile changed or if it's a release (see release-arm.yaml). This will save some runners time and I would actually like to do something similar with all other base images so I created a ticket for this #2034

run: |
docker push quay.io/kairos/ubuntu:nvidia-jetson-agx-orin-master

nvidia-arm-core:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvidia now is just consuming the factory with the ubuntu family and passing its base image

--IMG_COMPRESSION=${{env.IMG_COMPRESSION}}
- name: Show img sizes
run: |
ls -ltra build
ls -ltrh build
- name: Convert all json files into a reports.tar.gz file
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extended it so it can also be used on release-arm.yaml

rc-update add fail2ban

# Symlinks to make elemental installer work
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install && \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done on the kairos section now

###############################################################
#### Post-Process Common to All ####
###############################################################
FROM all
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in kairos section now

@@ -0,0 +1,86 @@
# WARNING: Do not build this image on its own, use the different Dockerfile.kairos-* instead
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not an independent image but the section that needs to run after the different family/distribution dockerfiles. At first I had this as an independent dockerfile that can run by passing a base image, however Earthly does not play well with local images, so for now I am using the target +kairos-dockerfile to concat the necessary family/distro dockerfile and this file. This is not ideal but I think it's a good step in the right direction, if we then publish base images #2034 then we can convert this one to a proper dockerfile and remove the target, plus the whole thing should be much faster

RUN rm -rf /etc/apt/sources.list.d/nvidia-l4t-apt-source.list

# Symlinks to make installer work
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install && \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now done in the kairos section

Comment on lines +10 to +12
ARG FRAMEWORK_VERSION=master
# Not to be confused with the concept of MODEL, this is either fips or generic
ARG SECURITY_PROFILE=generic
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are only here because I need to concat the files using the +kairos-dockerfile target, once #2034 is address they can be removed

@mauromorales mauromorales changed the title [WIP] ✨ Move Earthly logic into Dockerfiles ✨ Move Earthly logic into Dockerfiles Nov 29, 2023
@mauromorales mauromorales marked this pull request as ready for review November 29, 2023 08:52
@mauromorales mauromorales requested a review from a team November 29, 2023 08:53
images/Dockerfile.kairos Outdated Show resolved Hide resolved
images/Dockerfile.kairos Outdated Show resolved Hide resolved
images/Dockerfile.kairos Outdated Show resolved Hide resolved
# Regenerate initrd if necessary
RUN if [ -f "/usr/bin/dracut" ]; then \
kernel=$(ls /lib/modules | head -n1) && \
dracut -f "/boot/initrd-${kernel}" "${kernel}" && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just force dracut to overwrite the existing /boot/initrd directly?? that avoids one extra step here to link it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Itxaka hmm, sounds like a good idea, how does that work? for alpine if I understood correctly we would just need to remove the --no-scripts flag right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I meant that on alpine we generate the file directly overwriting anything while on dracut we generate a file and then soft link it for some reason? Dracut should be able to overwrite the file directly, so we don't need to link it afterwards

Copy link
Member

@Itxaka Itxaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking pretty good!

Could you link the issue for the docker images from earthly so we can track it down the line?

Earthfile Outdated Show resolved Hide resolved
Earthfile Outdated Show resolved Hide resolved
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
@mauromorales mauromorales merged commit 84f1eaa into master Nov 30, 2023
34 checks passed
@mauromorales mauromorales deleted the 1897-full-kairos-Dockerfile branch November 30, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Kairos dockerfiles should create full kairos images
3 participants