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

Build Docker images directly with Nix #607

Merged
merged 5 commits into from
Nov 11, 2024
Merged

Build Docker images directly with Nix #607

merged 5 commits into from
Nov 11, 2024

Conversation

aumetra
Copy link
Member

@aumetra aumetra commented Nov 11, 2024

In my relentless quest to use Nix for everything: behold, 100% space efficient Docker images.

This produces a Docker image that is 333MB large. Maybe not perfectly efficient sounding, but considering the dynamically linked libraries the GNU target needs, this is completely reasonable IMO.

Adds the new outputs:

  • cli-docker
  • job-runner
  • job-runner-docker
  • main-docker

Previously the regular main output included the job runner binary. Not anymore.

@aumetra
Copy link
Member Author

aumetra commented Nov 11, 2024

Using the dist profile cut off around 89MB. Probably through slimming down the binary and getting rid of some dynamically linked libraries that weren't actually needed.

Image is now 244MB large. Good enough.

@aumetra
Copy link
Member Author

aumetra commented Nov 11, 2024

Probably a bit more optimizable if we used musl instead, and tried to get rid of all dynamically linked stuff, and inspected what Nix is actually packaging. But this is good enough because we previously didn't have any guaranteed-to-build Docker images.

@aumetra aumetra enabled auto-merge (squash) November 11, 2024 15:52
@aumetra aumetra disabled auto-merge November 11, 2024 16:05
@aumetra aumetra merged commit 4ddeef8 into main Nov 11, 2024
16 of 17 checks passed
@aumetra aumetra deleted the aw/nix-dockerfile branch November 11, 2024 16:05
@aumetra aumetra restored the aw/nix-dockerfile branch November 11, 2024 16:05
@aumetra aumetra deleted the aw/nix-dockerfile branch November 11, 2024 16:05
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.

1 participant