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

Add Earthly support #121

Merged
merged 1 commit into from
May 27, 2024
Merged

Add Earthly support #121

merged 1 commit into from
May 27, 2024

Conversation

greaka
Copy link
Contributor

@greaka greaka commented May 26, 2024

Motivation

Earthly is a tool that allows you to create reliable build systems. It is kind of like a mix of GNUmakefiles and Docker and prides itself as being write once, build everywhere. Earthly can also import Dockerfiles and you can depend on other Earthfiles.

By adding an Earthfile that depends on the Dockerfile, you allow downstream users to import it and follow updates to the Dockerfile without manual intervention required. Like in Github Actions, you can follow branches, tags or commits too.

I use xwin for years now already and, so far, kept my Earthly-based repositories manually up-to-date. I would be very happy if I could automatically update in the future.

Technical Details

Earthly is very similar to docker buildx and buildkit based. The .earthlyignore file uses the same syntax as dockerignore and gitignore and is there to reduce the scope of the build context.

The Earthfile can be anywhere inside the repository, as long as the xwin.dockerfile is located in the same or a subdirectory of the Earthfile. The build context will always be the same directory as the Earthfile and is only affected by the .earthlyignore located in the same directory as the Earthfile.

So it would be possible to create for example a docker folder inside the repository, put the Earthfile and xwin.dockerfile files inside it, and remove the .earthlyignore. That would be equivalent to the way I structured this PR.

@greaka greaka requested a review from Jake-Shadle as a code owner May 26, 2024 23:24
@Jake-Shadle
Copy link
Owner

I guess I can merge this, but I guess I find it continuously surprising that people actually use the dockerfile in this repository at all, it was only ever meant as an example of how xwin could be used and I personally never update it because I don't use it on any projects I maintain, hence why it's using an ancient clang/llvm version etc.

@Jake-Shadle Jake-Shadle merged commit 6b72513 into Jake-Shadle:main May 27, 2024
8 checks passed
@greaka
Copy link
Contributor Author

greaka commented May 27, 2024

Thanks a lot!

I too switched away from the dockerfile in newer projects, but the issue of compiling resource files caused issue after issue, which led me to try the docker container again. This resolved all but the one issue, for which I put in a PR already.

@MarijnS95
Copy link
Contributor

@Jake-Shadle while someone has mostly copied the example setup to our Dockerfile CI (and we updated LLVM over time), yeah it looks like this is popular. I at some point want to pull apart that file into separate modules using multi-stage builds, and use your file again instead of rolling our own.

That does mean I'm contributing back improvements every once in a while :)

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

Successfully merging this pull request may close these issues.

3 participants