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

T3T1 support, space saving, GH actions emulators #234

Merged
merged 15 commits into from
Apr 9, 2024
Merged

Conversation

grdddj
Copy link
Contributor

@grdddj grdddj commented Apr 3, 2024

Support for T3T1 emulators

Decreasing the size of Docker image

Getting latest/main emulators from GH-actions

TODO: remove the temporary commit and load GH_TOKEN from env

@grdddj
Copy link
Contributor Author

grdddj commented Apr 9, 2024

In the end, getting the latest core emulators from trezor.io --- still depending on Gitlab for legacy and arm builds.

@vdovhanych I am already satisfied with this, can you please approve the small Dockerfile changes? It is just setting up Poetry garbage collection and moving all the RUN steps into one layer - which both make the image smaller.

I did quite a lot of experiments with decreasing the image size, with the idea of deleting as much nix-connected stuff as possible.

  • the majority of almost 4GB image is taken by stuff from /nix/store, which is however hard to delete, as it is needed for the app to run
  • I tried to get rid of it with e.g. nix-collect-garbage -d, nix-store --gc or nix-store --optimize - which helps in theory when run in the running container - but in the image phase, it deletes something, just to have it installed again when starting the application
  • One possibility is to convert the Dockerfile to start with ubuntu/debian base image - I tried it, it is possible to get the size around 1GB - however, I was experiencing issues with running the latest emulators and with bridges ... but this I guess is the ultimate way of making the image more user-friendly regarding the size and startup time (especially for Suite CI - @Nodonisko)
  • It is certainly possible to somehow decrease the size while keeping the nix base image - e.g. build the application in one build-stage and then copy just it into another runtime-stage ... this article seems to be the best I read, which however utilizes flake.nix instead of shell.nix --- https://mitchellh.com/writing/nix-with-dockerfiles

There are two upcoming tasks/TODOs:

Copy link
Member

@vdovhanych vdovhanych left a comment

Choose a reason for hiding this comment

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

If we do not use the download option from GitHub then its fine like this, but read my comment for that.

@grdddj grdddj merged commit 0037081 into master Apr 9, 2024
1 of 2 checks passed
@grdddj grdddj deleted the grdddj/t3t1_emu branch April 9, 2024 13:13
@grdddj grdddj mentioned this pull request Apr 9, 2024
@Nodonisko
Copy link

@grdddj As I said I don't see that much benefits from using Nix inside of Docker image so I vote for removing it.

@vdovhanych
Copy link
Member

Im already working on simple alpine image without nix, should be third the size

@Nodonisko
Copy link

@vdovhanych Nice thanks! Every saved MB here = saved few minutes of runtime in total across all our CI jobs

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