Harvey-OS / harvey

A distributed operating system
https://harvey-os.org/
MIT License
1.44k stars 107 forks source link

Set up Dockerfile to optionally build from local folder #1201

Closed gmacd closed 3 years ago

gmacd commented 3 years ago

Build from a local folder if it's been mounted by docker

For CI, run docker run --rm -it --cap-add SYS_ADMIN --privileged harvey:Dockerfile

To build from the repo: docker build -t harvey:Dockerfile . && docker run --rm -it --cap-add SYS_ADMIN --privileged harvey:Dockerfile

To build from a local directory: docker build -t harvey:Dockerfile . && docker run --rm -it --mount type=bind,source=$HARVEY,target=/usr/local/harvey_local,readonly --cap-add SYS_ADMIN --privileged harvey:Dockerfile

It's not very sophisticated - it mounts the local repo, then copies it to another directory before building. There's probably some cleverer way to do it, but it works.

It does simplify some things - the linux toolchain is placed in /usr/local/harvey_local - referred to throughout as HARVEY_LOCAL. This gets rid of the arch-specific directory.

To test the PR, you'd need to change HARVEY_OWNER to gmacd and HARVEY_BRANCH to docker-local in the BUILD_IN_DOCKER script.