9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.6k stars 318 forks source link

Dockerfile to build plan9port in Alpine Linux container #618

Open JamesParrott opened 1 year ago

JamesParrott commented 1 year ago

Hi all.
I'm adding this for others to show which packages are definitely needed in the host environment to build plan9port, and maybe even spin up a container for themselves easily. When building from a docker file, certain errors seem to be suppressed. I hadn't noticed perl was being used at first. So it is possible I've unwittingly removed something essential. But rc seems to work on the surface.

A .gitattributes file is also included. This reduces the pain for Windows users building Docker images from a local plan9port repo (otherwise Git may change the line endings to crlf).

I haven't had much joy with https://pkgs.alpinelinux.org/package/edge/community/x86/plan9port (perhaps I hadn't carried out a final configuration step, but it appears some build directories are hardcoded into it).

This image did work: https://hub.docker.com/r/plan9d/plan9port but I've no clue what was in the hashes it builds from, so I reverse engineered it by diffing apk list--installed with alpine:build-base, and afterwards stripped out the packages unnecessary, simply to compile plan9port, by trial and error.

sevan commented 1 year ago

Seems strange to have a Perl requirement, did you confirm if that was needed?

JamesParrott commented 1 year ago

Seems strange to have a Perl requirement, did you confirm if that was needed?

I entirely agree! It only added about 35MB to a 350-400MB image so I left it in to be safe.

I confirmed a number of calls to perl are definitely in the installation code (by simply using Ctrl+F). I believe there was even a commit to specifically call /usr/bin/perl for BSD, relying on my unreliable memory.

I cannot confirm removing perl breaks anything(*) when plan9port is built via a Dockerfile being built. So if perl's not redundant, and something else is broken without perl that I'm unaware of, perhaps someone could add a PR that makes the build process fail more noisily in the absence of perl.

(*) I've only tested running rc and calling ls in it