Today I’m going to talk about Docker. I may have been laying around a draft about my start on Docker world, but probably will be below some web dust by now in my drafts…
Docker is a great tool, but I never got the chance to go deep. I used Rafael Gomes aka Gomex book to start on this world. And today I had the chance to make a good use of it.
Atelier and AtCore use dependencies of Qt 5.7, but the most common distros around use the 5.6 version or less. That give us issues when someone tries to build our project. Because of that happening a lot of times lately, I thought that a Docker Container could give me a hand on it.
So a few hours ago I started to make a Dockerfile, using Fedora 25 like my base distro to build AtCore and it’s testing client.
After some errors in my logic and lack of understanding of Docker, like this:
RUN mkdir build && cd build RUN cmake ../atcore
Where, when you change line, you change the current container, so the path goes back to the root, and you start to have problems with it… After I understood that, was easy to fix the issues. And the final Dockerfile is this one:
FROM fedora:25 WORKDIR /home/build #Setup RUN set -euxo pipefail; dnf -y update && dnf -y install \ git \ qt5-qtbase \ qt5-qtserialport-devel \ qt5-qtserialport \ qt5-qtcharts-devel \ qt5-qtcharts \ cmake extra-cmake-modules && \ git clone https://github.com/KDE/atcore.git && \ cmake atcore && make install CMD ./testclient/AtCoreTest
It’s pretty straight the path to building it. So I connected my Github account to Docker Hub, and the magic started, the Docker build my image, and the only thing that you need to do is run the container on your machine and use it.
The only thing that you need to pay attention is that you need to pass the path of your serial device(your 3d printer) to the container, so it can have access and you can connect to your printer without issues. All that is explained in the readme.
You can find the Dockerfile and Readme here.
If you want to give a try you can go on my Docker account here.
This container can be used on Mac and Windows, but I want to give it a try before I explain to you the way.
I was helped by Rafael like I said in the beginning of this post, where his awesome book that is available for free in Portuguese and soon in English, and for Junior aka Somatorio, where his blog about how to run Docker applications with GUI using X11 and a little guidance on the Docker group on Telegram was the cherry that was missing of my cake, and fit perfectly to the goal of this challenge.
I really love when I start to do something that is challenging and I’m able to do it without struggle too much. Is moments like these where I think that I’m on the right path.
Well, that’s all folks! =D