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

feat: add local Docker/Podman build option #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

calebdw
Copy link

@calebdw calebdw commented Oct 3, 2023

Hello!

The current method of building the firmware using Github Actions is great for those who are less familiar with the programming world, however, I'm not really a fan of the process (commit, push, wait, download, extract) especially during iterative development---I'd much rather just build locally on my machine.

This PR introduces the option to use Docker/Podman to build the firmware locally (inspired in part by the Kinesis360 Docker build). The Docker image:

  • parses the build.yaml to avoid config duplication
  • caches the build in a build volume which allows subsequent builds to compile faster
  • properly handles user permissions between the host system and container
  • outputs the compiled firmware to the firmware directory
  • (optional) outputs the full config to the firmware directory when OUTPUT_ZMK_CONFIG env variable is set

I implemented all of this in my own zmk config repo, however, some of this can be cleaned up by:

  • moving the build.sh to the main zmk repo (Dockerfile would then copy this in)---this would allow zmk to update as needed without having to sync the file across users' repos
  • I install yq (yaml equivalent to jq) to parse the yaml file, this could possibly be moved into the base image

Thanks!

firmware/.gitignore Outdated Show resolved Hide resolved
@caksoylar
Copy link

caksoylar commented Oct 3, 2023

This seems useful, but I am worried about people getting confused (in general, in addition to the point I made about the firmware folder). Users already have trouble making assumptions about what files to modify and how, and adding a Makefile and build.sh might make things worse.

I think with this change we could really use a README or something to tell people what file does what, and what they'd need to modify in order to accomplish what they want to do. However I wouldn't commit to anything before getting the opinion of @petejohanson.

@calebdw
Copy link
Author

calebdw commented Oct 3, 2023

Ideally, the build.sh file would live in the zmk repo and would be copied into the Docker image in the Dockerfile

I can add a README, Below is an example from the Kinesis360 repo showing the different build options:

https://github.com/KinesisCorporation/Adv360-Pro-ZMK

Copy link

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

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

I'm not generally opposed to this, but I think if we're doing this, it needs some basic documentation as well placed in the repo, or in our main docs site, for how to use this effectively, what it does, etc.

Thanks for the work on this!

Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
bin/build.sh Outdated Show resolved Hide resolved
@calebdw
Copy link
Author

calebdw commented Oct 3, 2023

@petejohanson, I can PR the build.sh into the main zmk repo if you like

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