-
Notifications
You must be signed in to change notification settings - Fork 165
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
Docker image improvements (CON-282) #138
Conversation
3a9a186
to
3c25eaf
Compare
Rebased to include python requirements |
Hi @Diegorro98, yes we do have a work in progress on this for quite some time. I had Dockerfile and the workflow ready but we were still thinking about adding it to esp-matter.
But, looks like this is the high time that we add it. So, I have already put up an PR internally for the required changes. My changes uses chip-build-esp32 docker image and yours uses the IDF base image. I did not consider the IDF v5.0 case. May be we can merge our WIP changes and then you can rebase and put up the extra's that you have on top of it? |
@Diegorro98 Thank you very much for contributing |
Hi @shubhamdp, thank you for reviewing! |
@Diegorro98 We have merged the changes, please take a look. Dockerfile and Workflow Reason for using |
3c25eaf
to
5d51d05
Compare
@shubhamdp I already added extra stuff like arguments, an entrypoint so it can be used easily with About the IDF v5.0, I'm not sure how to implement it, I was thinking to use chip-build as base image and rewrite this Dockerfile from the chip-build-esp32 so we can give arguments and can be changed. What do you think about it? I will do the changes and push them so the idea can be visualized. If the idea is discarded I will return revert the changes by undoing them and pushing. |
47f6824
to
10740a3
Compare
I thought about other alternative which would copy from the esp-idf image the required files this way: ARG ESP_IDF_TAG=v4.4.3
FROM espressif/idf:${ESP_IDF_TAG} as idf
ARG VERSION=latest
FROM connectedhomeip/chip-build:${VERSION}
ENV IDF_PATH=/opt/espressif/esp-idf/
ENV IDF_TOOLS_PATH=/opt/espressif/tools
COPY --from=idf /opt/esp/idf /opt/espressif/esp-idf
# Setup the ESP-IDF
WORKDIR /opt/espressif/esp-idf
RUN set -x \
&& ./install.sh \
&& : # last line But It would lead to bigger image size (more or less 0.7 GB bigger), more processing time (2 min more, which might be irrelevant) and less control over esp-idf because ESP_IDF_TAG would be the only option vs the options that are pushed right now. The only benefit of this is code simplicity in the Dockerfile. |
@Diegorro98 better would be that we use the IDF docker images and install connectedhomeip dependencies. shallow clone the esp-matter and run install.sh Probably what you did earlier |
Since, we are building it for multiple idf versions, we may have to modify the workflow to build it for both idf v5.0 and v4.4.3 We can use matrix for this. |
@shubhamdp okey, I'm gonna restore that in a new branch and I will post the link to the branch here so you can compare both solutions. I will also build and push the image result to the my esp-matter docker hub.
I can do that, no problem 😄 |
73d6d7c
to
78a9b14
Compare
https://github.com/Diegorro98/esp-matter/tree/feature/docker_image_alternative This is the branch with what I did earlier with some changes. Images from the actual changes in this pull request and the mentioned branch, each one with idf v4.4.3 and v5.0, are at my docker hub: |
Hi @Diegorro98 I have been working on supporting esp-idf v5.0, project-chip/connectedhomeip#24589. Once that gets merge, we will pull those changes into esp-matter and can take this up to build examples with both idf v4.4 and v5.0 |
Hi @shubhamdp, I have seen that in 2a7abbb you have changed from |
Can I comment that the images built by espressif are all tagged as |
78a9b14
to
1d941d0
Compare
Rebased in to include latest changes |
@shubhamdp ESP-IDF 5.0/5.1 is already supported in current Matter commit right? |
@Diegorro98 I wanted to review this PR since last two weeks but couldn't do that. There are few changes that will be needed to get this merged, I'll review the PR this week and lets get this merged then. |
@shubhamdp awesome! thank you for you answer :) |
@shubhamdp Changes done! The image tag format will be |
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.
I'll give a try to these images on my fork of esp-matter to build examples as well.
Also need to pass in full SHA ref for the following command to work. It fails with abbreviated ref's.
|
@darkxst Also true, I really thought it worked because the build passed, but it passed because the checkout reference wasn't used due to the error you mentioned in last review. Thank you a lot for the feedback! |
I've found that building docker files at GitHub Actions tends to file because of the space; I've also found that setting the following steps at the workflow frees enough space to be able to create the docker image: jobs:
build:
steps:
- run: sudo rm -rf /usr/share/dotnet
- run: sudo rm -rf "$AGENT_TOOLSDIRECTORY" @shubhamdp, what do you think? Should I add it? |
If this works then please add that. |
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.
@Diegorro98 Sorry for the delay and thanks for making this effort. I have few minor suggestion and we are good to merge this.
30584fc
to
0b6121e
Compare
@Diegorro98 Please |
@shubhamdp sorry, what do you mean by "stash the commits"? |
@Diegorro98 sorry, I meant squash. |
4837b5c
to
2a443fe
Compare
@shubhamdp is that okey? |
2a443fe
to
c44d614
Compare
@Diegorro98 Can you please rebase to latest main branch. I pushed these changes internally but failed. |
c44d614
to
3cef104
Compare
@shubhamdp rebased! |
Thank you @Diegorro98 for your contribution and patience ;-) :-D |
@dhrishi no problem, glad to help! 😊 BTW, I've seen that the workflow didn't work Also I forgot to include a comment explaining these two steps I added to the workflow:
Should I create a new PR including the fix and the comment? |
@Diegorro98 Thanks for bringing it up. I've already raised a PR to fix this, along with few other relevant changes. |
@Diegorro98 I've not added the comment though to my fixes, may be you can do that. |
@shubhamdp sure! I'm going to create a new PR with the comment then. |
I created this workflow because I needed to create an image to perform an automated building for my project, so now I'm apporting the workflow to this repository.
The dockerfile is based on esp-idf docker images (v4.4.2 by default as it is the supported IDF version , but it can be changed with build args).
Also I created a readme file that contains info about the images and build args that can be used with the dockerfile. I wish I had more info about the docker image which tag is
chip
and its purpose in order to write it into the docs too, but I left some space for that here:esp-matter/tools/docker/README.md
Line 12 in b970273
arm64 build has the problem that takes too long (between 2 and 4 hours) to setup the python environment when bootstrapping Matter and more than 1.5 hours building host tools. Here you can see a workflow that tried to build amd64 and arm64 image but it exceded the maximum execution time. That's why I disabled the arm64 build in the last commit.
You can test an amd64 image pulling from my docker hub: https://hub.docker.com/r/diegorro98/esp-matter/tags
Also fixes #89.
As mentioned at #89 (comment)), Maybe there is a WIP workflow on the internal repository or similar to create an image with the same purpose.