shakenfr / x11basic_docker

Docker en for x11 basic
2 stars 0 forks source link

Integrate Dockerfile in main repoitory? #2

Open kollokollo opened 3 years ago

kollokollo commented 3 years ago

Hi Bruno (shakenfr), thank you for having made this dockerfile for X11-Basic. I myself have not used docker so far, but I want to learn about it. I have moved the X11Basic repository (also) to codeberg.org https://codeberg.org/kollo/X11Basic and on codeberg there is the discussion about CI (= continous integration). This means, there should be a way for a process running on codeberg.org to automatically build and deploy X11-Basic. So basically grab the repository and make .deb files out of the sources, which then are deployed as release assets. https://codeberg.org/kollo/X11Basic/releases

I like that idea. But as far as I have understood it is not clear how to do it. Docker comes into play. And someone explained to me that a simple(?) Dockerfile in the repository can do the job. This reminded me of your repo x11basic_docker. What do you think? Would that make sense?

shakenfr commented 3 years ago

Hello,

I try to explain with my bad english.

You have to separate the Dockerfile that build an image and the CI that is the automatic process to build it. The build : I created a Dockerfile to put X11 basic in it. The goal is to be sure X11 basic works inside an environnement. Each people has its linux distrib, with different patch, version, package, dependencie and it's sometimes difficult to have a working X11-Basic (missing dependencies etc...).
You run on your distrib docker exec and you can use X11basic.

The CI/CD :+1: The idea is to automatise the deployment process. For exemple: when a X11 basic new version is released, an automatic process can start the creation of a new docker image with a modification of the Dockerfile. ex: with gitlab ci for exemple with can do that using something like only change Dockerfile and do a new image creation.

First thing is to think what we can do to define a CI/CD process.

Each time you release the X11 basic package --> modify automaticaly the docker file with the version for exemple, then create a new image, then publishing on docker hub the new image ...

If I have time I can test something like that

kollokollo commented 3 years ago

Thank you for your answer. Lets see, if I get things right. I have installed docker on a Ubunut 20 machine and made a folder with the Dockerfile in. Then I have run (inside that folder): sudo docker build . -t shakenfr/x11basic:0.2 as you have explained in the readme.

... it is still operating .... taking quite a bit ....

now done. But the folder still has only the dockerfile. I am now doing a sudo docker pull shakenfr/x11basic:latest still nothing changed in the folder. Where is this stuff going after downloading? From where is it downloading? I am now doing a sudo docker images and I get

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
shakenfr/x11basic   0.2                 7a246da50c0f        4 minutes ago       753MB
debian              jessie              51cc11b6a471        4 weeks ago         129MB
shakenfr/x11basic   latest              66adbe17561f        11 months ago       756MB
kollokollo commented 3 years ago

I do a sudo docker run -v dockerfilevolume -ti -v/home/bruno/projects/x11basic_docker/:/dockerfilevolume/ 611dd3e69131 xbc 1.bas but I get

Unable to find image '611dd3e69131:latest' locally
docker: Error response from daemon: pull access denied for 611dd3e69131, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
kollokollo commented 3 years ago

I think I found the error: I need to use the 7a246da50c0f instead. Now I am in the container. I see.

I think I now understand briefly how this is supposed to work. Lets see If I can make the .deb package and move it out of the container.

I tried to do a "make deb" but I see, that checkinstall is missing and also the User-Manual could not be made, because latex is also not installed in the container. (/doc/manual/Makefile needs to be excecuted) Ill try to modify the Dockerfile and try again...

shakenfr commented 3 years ago

Well I think you begin to understand how to use docker, good job. The thing that is not easy is to make a correct docker file that works. A container is like a small OS without a lot of unnecessary tool, dependencie to be as small as possible. So to create a Dockerfile with what you want inside, It's often necessary to go inside the container to test if something is missing. docker images lists the images, created by a Dockerfile , that are in your host. After you can do a docker run command to go inside the container but be careful, if you open another terminal on your host and do another docker run, you will be in another instance and not the same instance. you can see that that using 'docker ps'. You can use also 'docker exec -ti to go to the same container. When you're container is ok, you can publish it using : docker tag :version and docker push :version

then after for example I can do a docker pull of your image and using it.

Well It's difficult to explain that in few lines but if you want I have a messenger account for exemple. And if you want I can share you a part of my ESX server to create virtual machine for your work. It can be useful if I need to debug something or help. A sort of share server :-)

Tell me if necessary.

kollokollo commented 3 years ago

Thank you. Well I have played a bit more with the Dockerfile. I think I have managed to compile the User-Manual and also build the debian package. Thats cool. (If you are interested, the results are here: https://github.com/kollokollo/x11basic_docker/tree/new )

What I am interested in is how that could be integrated into a CI process, Currently under discussion is Jenkins or drone. But I have no clue about this and it has also not been implemented. However I want to learn. And Docker seems to be a core part of it.

BTW: can docker also setup a container with a different processor architecture (arm) and Raspbian?

shakenfr commented 3 years ago

well for CI process, I know Jenkins and Gitlab CI. I don't know drone. I thing that the "today" tool is Gitlab CI if you want to do a CI. Jenkins can do but the CI/CD "fashion" choise is gitlab CI. But with gitlab CI, you need to know yaml syntax and gitlab keywords to use it. For me (and at work) the today choise is Docker with Kubernetes cluster for containers and Gitlab CI for CI.

I'm not 100% but running differents arch containers as the host will not work. Maybe have a look here for that : https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

I have no experience on multiarch. When I use my rasp I've have the arm version of docker.

I try to have a look of your work link tomorrow. Good job !!