-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Reusable Docker image #29
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1d14ffd
Use makefile for a reusable docker image
joshfrench b3e58a5
Update docs
joshfrench 1660f0c
this is being handled elsewhere
joshfrench 3b0bfd7
Remove old scripts
joshfrench 90c3c41
We only need config/west.yml at this stage
joshfrench 4f09557
Specify setup prereqs
joshfrench a7c0395
Merge remote-tracking branch 'kinesis/V2.0' into makefile
joshfrench 7e9cb93
timestamp doesn't need to be a target
joshfrench File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TIMESTAMP := $(shell date -u +"%Y%m%d%H%M%S") | ||
|
||
.PHONY: clean setup | ||
|
||
all: setup build | ||
|
||
build: firmware/$$(TIMESTAMP)-left.uf2 firmware/$$(TIMESTAMP)-right.uf2 | ||
|
||
clean: | ||
rm ./firmware/*.uf2 | ||
|
||
firmware/%-left.uf2 firmware/%-right.uf2: config/adv360.keymap | ||
docker run --rm -it --name zmk \ | ||
-v $(PWD)/firmware:/app/firmware \ | ||
-v $(PWD)/config:/app/config:ro \ | ||
-e TIMESTAMP=$(TIMESTAMP) \ | ||
zmk | ||
|
||
setup: Dockerfile bin/build.sh config/west.yml | ||
docker build --tag zmk --file Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be out-of-scope, and I'm not familiar with
west
, but might it make sense to not have these as multiple layers1? Only bringing up since this is about improving the image building process.Footnotes
Hadolint DL3059 ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. I combined these
RUN
lines but it did not make a difference in the image size; apparently it isn't doing too much in the way of transient files? I also don't know enough aboutwest
to say which of those commands are likely to bust the layer cache, so I'm inclined to keep them individually cache-able.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, my very next run demonstrated this in action:
The rule you linked to makes the tradeoff clear and I'm ok optimizing for speed in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O sorry, it shouldn't do anything for the size/speed, should just effect the layers that Docker generates. I was thinking it may be a case similar to https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get (with subcommands like init and update).
Can avoid issues where earlier stages succeed & cached, resulting in later stages to have a(n) inconsistent/un-reproducible/non-updating state. I.e. they're actually coupled stages and should be apart of the same
RUN