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

Docker #64

Closed
leoheck opened this issue Dec 10, 2022 · 14 comments
Closed

Docker #64

leoheck opened this issue Dec 10, 2022 · 14 comments

Comments

@leoheck
Copy link
Owner

leoheck commented Dec 10, 2022

Hey @TadeasPilar, I saw you were making good progress to run Kiri with Docker.

I was also doing the same some days ago.

Did you make progress on that?

I manage to make something today, and I put my work here https://github.com/leoheck/kiri-docker
It is a different repo since it does not need anything from the main Kiri repo since everything will be inside the Docker.

I invite you to check if it works for you.

I just tested it on my Ubuntu Linux, so for me, it is working already. I want to test on other systems and improve it a bit when I have more time.

Also, it generates .kiri files in place (inside the repo of the project on the host)

To run it, you just need to do

make build # to build the docker image
./kiri PROJECT_PATH
@TadeasPilar
Copy link

TadeasPilar commented Dec 13, 2022 via email

@leoheck
Copy link
Owner Author

leoheck commented Dec 13, 2022

I don't think it was hard. My image and script also allows you to open GUI's too. The run script works with the already created container. You don't have to rebuild the container everytime to put your files in it. I also shared the existing image on docker hub.

This is my first approach tho. It can be improved with time.

I don't think it takes 20 minutes to build. But I have to evaluate this closely to have a better idea.

You said it is very excessive. Very excessive in which sense?

Ah, by the way, thank you for the feedback @TadeasPilar

@TadeasPilar
Copy link

TadeasPilar commented Dec 13, 2022 via email

@leoheck
Copy link
Owner Author

leoheck commented Dec 13, 2022

For this, GUIs aren't all that useful.

Sure, I totally agree with you. In this case, it looks like it needs 2 different images.
One that is as light as possible, to download/build fast.

Also, there is this case that I am creating initially, that allows me to debug and test things and evaluate this Docker thing, easily.

I think I will also provide this second image for the reason you are describing, and doing the same as you, using the kicad_auto image, to make other tools available.

My biggest issue right now, is the need for active server running in the background.

It does not need that.. you can disable the server with the parameter -l to not launch the server in the end. There is also an option for Kiri to archive the generated files. This option, if I am not mistaken, generates a package with the webserver script inside...

So, if you unpack the files on another computer, you can start the server quickly by running the script that is already inside the folder

@leoheck
Copy link
Owner Author

leoheck commented Dec 13, 2022

Ah, for reviewing schematics of a project using Kicad 6, kiri needs GUI tools, since it plots schematics using xdotool once there are no tools that can do the same with the command line like plotgitsh does for Kicad 5

@leoheck
Copy link
Owner Author

leoheck commented Dec 16, 2022

@TadeasPilar I figured out that my current Dockerfile was very badly optimized and the image was consuming a lot of space. Now it is a bit better. Also, I have removed some unnecessary dependencies like wxpython* that are not really necessary for command line operation. Feel free to check my docker file for the currently required dependencies. i

For instance, these lines are not necessary to run kiri, specially of command line only is used.

#Downgrade libraries to allow installing libgtk-3-dev
RUN apt-get install libepoxy0=1.5.5-1 libatspi2.0-0=2.38.0-4 libatk1.0.0=2.36.0-2 libatk-bridge2.0-0=2.38.0-1 -y --allow-downgrades
RUN apt-get install pkg-config libgtk-3-dev -y
RUN pip3 install --no-compile --verbose "wxpython>=4.0.7"

I still did not try to generate an image using ghcr.io/inti-cmnb/kicad6_auto:dev as the base image. But it may happen eventually, so all command line tools can be available easily.

@leoheck
Copy link
Owner Author

leoheck commented Dec 16, 2022

The compressed image, if someone wants to donwload, is 1GB now, https://hub.docker.com/r/leoheck/kiri/tags

Without compression it takes 3GB

@leoheck
Copy link
Owner Author

leoheck commented Dec 16, 2022

It is taking 8 minutes to build the image on my machine now.
It is using 2.84 GB.
And the compressed form, online, is 982.15 MB already.

I think I can still trim it a bit more...

@leoheck
Copy link
Owner Author

leoheck commented Dec 18, 2022

@TadeasPilar I added a new Docker file with kicad_auto tools. This one https://github.com/leoheck/kiri-docker/blob/main/Dockerfile_kicad-auto.

Example of usage, using pcbdraw:

./kiri /home/lheck/Documents/assoc-board -i leoheck/kiri:test -d -c "pcbdraw board.kicad_pcb board.svg"

@edahlseng
Copy link
Contributor

This looks interesting, maybe the Docker image could be used to support a GitHub Action that could be easily shared?

@leoheck
Copy link
Owner Author

leoheck commented Jan 6, 2023

Yeah, that would be interesting too.

@Conor-Burns
Copy link

I'm also interested in the GitHub action. That would be a great feature!
Will try to experiment a bit.

@leoheck
Copy link
Owner Author

leoheck commented Jan 11, 2023

Nice, I did not have time yet to check this. But in the past, I was using some existing actions to achieve that. So, I stopped doing that at that time because I could not find an easy way to host kiri's website while browsing an Issue or PR, for instance. Yes, I could send data back to the Issue/PR, and I also created a flag to easily archive the run ( -x|--archive) and an easy way to review the results (https://github.com/leoheck/kiri#archiving-generated-files) without having kiri installed locally, but I really wanted to have a way to use the web service on the fly. Today I may find something. I will check what I can do but help on that can be used too. Thanks you.

@leoheck
Copy link
Owner Author

leoheck commented Feb 6, 2023

Closing this, please open it again if needed.

@leoheck leoheck closed this as completed Feb 6, 2023
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

No branches or pull requests

4 participants