|
Post by bigbass on Feb 7, 2023 22:34:56 GMT 1
Hello Peter
some feedback on the latest docker in fossil
all compiled and ran correctly
just a cheat sheet for quick pasting and testing
#========================================== # set up X11 to display from the docker #==========================================
#1.) #add the docker to the list that X11 can use in its display
xhost +local:
#2.) #shorten a long line of code
export X2DOCKER=" -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon"
#========================================== # launch three Bacon GUI's one at a time #==========================================
#3.) #run the new bacon editor gui inside the docker
docker run $X2DOCKER bacongui-gtk
#close the window then launch the next gui
#4.) #run the new bacon editor gui inside the docker
docker run $X2DOCKER bacongui-fltk
#close the window then launch the next gui
#5.) #run the new bacon editor gui inside the docker
docker run $X2DOCKER bacongui-tk
|
|
|
Post by bigbass on Feb 19, 2023 18:16:08 GMT 1
Hello Peter
I set up yet another new Manjaro SD for the RPI3
reference Check-in [400f2041dc]
Congratulations, all requirements are met!
- Makefile created. - Using '/usr/bin/ksh' to compile BaCon. - Creating BaConGUI for GTK3. - Creating BaConGUI for FLTK. - Creating BaConGUI for TK.
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest d254880d58ed 24 minutes ago 906MB debian bullseye-slim 57ef255b4834 10 days ago 74.3MB
all looking good will try a fossil build too later today
Tip for anyone that wants to test bacongui-* as a stand alone outside of the docker if you used ./configure --prefix=/usr
add this to the .bac file
DECLARE DATA_PATH TYPE STRING DATA_PATH="/usr/share"
Joe
|
|
|
Post by Pjot on Feb 20, 2023 7:14:17 GMT 1
Thanks Joe for the verification!
BR Peter
|
|
|
Post by Pjot on Feb 20, 2023 20:05:37 GMT 1
Today I tried to install and run the new TK editor on my Android phone. I used TermUX and followed the instructions on their wiki, using the VNC steps (the local X-servers did not work on my Android 9). It's completely useless of course, but fun nevertheless
|
|
|
Post by Pjot on Feb 22, 2023 20:09:07 GMT 1
When creating a Docker image, size matters. Often Alpine Linux is a good choice, as its bare image is only 8Mb in size. Alpine Linux however uses a difference C library, called musl C. Though BaCon did compile fine already in Alpine Linux, I added some improvements to the BaCon code base to make it work without additional quirks and parameters. Note that when using BaCon from an Alpine Linux container, the generated binary also is based on musl C, and may not execute on your platform. In such case, simply recompile with the "-l -static" flag. This is the Dockerfile using Alpine Linux, the resulting image is only 316Mb. To keep things small, no GTK stuff. FROM alpine:latest
RUN apk update RUN apk add build-base musl-fts-dev zsh flex indent xterm tcl-dev tk-dev openssl-dev pcre-dev font-dejavu
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
RUN ./configure --enable-gui-tk RUN make RUN make install
RUN rm -rf /var/cache/apk/*
WORKDIR /tmp
The usual commands work, to plainly run bacon from the command line: # docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp bacon:latest bacon -l -static program.bac
To use the TK editor, we can use Joe's command: # xhost +local: # docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp \ -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon:latest bacongui-tk
BR Peter
|
|
|
Post by bigbass on Feb 23, 2023 1:23:28 GMT 1
Hello Peter Thanks for yet another docker image !
Glad to see you tried Alpine since its so different than the usual linux setup with its special way to to do everything that should provide you with some good testing of the compiler
I thought about doing some micro build since I did chroot builds many years ago on slackware and the overall idea is the same to pass the DISPLAY
but I am kinda busy digging into another project with Qt at the moment and sorting out the porting part is about all I can do one thing at a time
back to the feedback got a little distracted in thought
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest 6015d5ff8c53 11 minutes ago 315MB alpine latest d74e625d9115 12 days ago 7.46MB
and the bacongui-tk built and ran correctly
great that you made a light GUI for bacon and I see that it works on android also cool will try that over the weekend my phone is about full
Joe
|
|
|
Post by bigbass on Mar 7, 2023 6:26:29 GMT 1
Hello Peter
using bacon-e063f93086
I wanted to follow the idea you had for debian but with Alpine so here is the new Dockerfile with some changes
FROM alpine:latest
RUN apk update RUN apk --no-cache add \ make mimalloc gcc zsh \ musl-fts-dev libc-dev binutils flex indent xterm pcre-dev
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
RUN LDFLAGS=-l:libmimalloc.so.2 ./configure #RUN LDFLAGS=-l:libtcmalloc_minimal.so.4 ./configure
RUN make RUN make install
RUN rm -rf /var/cache/apk/*
WORKDIR /tmp
I wanted to see if we could use mimalloc as a replacement
after the Docker is built lets poke inside and see how it is working inside
--------------------------------------------------------------------------
docker run -it --entrypoint /bin/zsh bacon
cd .. ls bin etc lib mnt proc run srv tmp var dev home media opt root sbin sys usr
cd /usr/lib ls Scrt1.o libmimalloc-secure.so.2.0 X11 libmimalloc.so.2 bfd-plugins libmimalloc.so.2.0 crt1.o libmpc.so.3 crti.o libmpc.so.3.2.1
the goal here is to see what they call the lib
next step lets see if the lib was linked when it was built or not
docker run -it --entrypoint /bin/zsh bacon cd .. ls bin etc lib mnt proc run srv tmp var dev home media opt root sbin sys usr
cd /usr/local/bin ldd bacon /lib/ld-musl-aarch64.so.1 (0xffff8ec3e000) libmimalloc-secure.so.2 => /usr/lib/libmimalloc-secure.so.2 (0xffff8eaca000) libfts.so.0 => /usr/lib/libfts.so.0 (0xffff8eaa9000) libc.musl-aarch64.so.1 => /lib/ld-musl-aarch64.so.1 (0xffff8ec3e000)
ok here we get ld-musl-aarch64.so.1 and libmimalloc-secure.so.2 good news it worked!
and now for the docker size
docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest 221093e17656 5 hours ago 171MB alpine latest d74e625d9115 3 weeks ago 7.46MB
looks good so far but haven't tested if there is any speed differences yet for memory calls
Joe
|
|
|
Post by Pjot on Mar 7, 2023 18:34:25 GMT 1
Hi Joe,
Nice! That's really small. I can see some changes in the added tools, but also the TK editor is missing. Nevertheless, such small image can be really handy!
Thanks Peter
|
|
|
Post by bigbass on Mar 8, 2023 16:59:59 GMT 1
Hello Peter following your first post with a Debian based docker it later got improved by reducing the overall size throughout the thread now using Alpine as the base the docker can be reduced to mirror the debian docker idea only using musl and a different malloc called mimallocthe plan here was to reduce the docker size needed for bacon only to a minimal next we can add in any GUI that is needed and calculate the difference added sizes there are some trade offs size vs speed and time to build and dependencies on libc.so.6 or libc.musl-aarch64.so.1 (depends on your arch) where gcc is a much more robust compiler . I like clang and clang++ but that adds more size the important part of this is we can allow for different options and at the end of the day bacon gets installed Joe here is a Dockerfile for Alpine I just built it again to be sure it works docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest 4ab49686585b 3 minutes ago 171MB alpine latest d74e625d9115 3 weeks ago 7.46MB # --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # # Create the Docker image with: # docker build -t bacon . # # Run the BaCon converter as follows: # docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp bacon:latest bacon -l -static myapp.bac # # To also run one of the BaCon editors: # $ xhost +local: # $ docker run --rm --volume $(pwd):/tmp --user "$(id -u):$(id -g)" --env HOME=/tmp -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY bacon:latest bacongui-tk # # Thanks to BaCon forum member Joe for sorting out how to run the GUI versions from a container and keep the container small.
# after the Docker is built lets poke inside and see how it is working inside # EXTRA HACKING the word "bacon" here is the name of the container not the binary # docker run -it --entrypoint /bin/zsh bacon # now you can cd .. into any docker internal folder and run zsh commands! # ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FROM alpine:latest
RUN apk update && apk --no-cache add \ make mimalloc gcc zsh \ musl-fts-dev musl-dev flex indent xterm pcre-dev
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
#ALPINE mimalloc linked with libc.musl RUN LDFLAGS=-l:libmimalloc-secure.so.2 ./configure
RUN make && make install
WORKDIR /tmp
|
|
|
Post by bigbass on Mar 10, 2023 2:20:58 GMT 1
hello Peter just have to add it back in to see the size has changed we are now at with the TK GUI docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE bacon latest 3ba879be064a About an hour ago 210MB alpine latest d74e625d9115 3 weeks ago 7.46MB I used the mimalloc option Alpine reminds me of the first time I used zipslack and installed it on a 486 100Mhz computer its too bad that slackware stayed behind in the multi arch area and that's where debian dominated the show the smaller or the smallest distros are the new development tools such as Alpine for a docker image I still haven't run Alpine as a full operating system (boot it from the sd card on the RPI3) but you can test stuff inside a docker and get a feel for how it works and even view x11 apps a nice way to test your work and see exactly what it needs to run for the full powered experience I am happy with raspbian and Manjaro Manjaro for the easy updates of the whole system without breaking stuff in the process wish Manjaro had an easy small sized docker Peter thanks for introducing me to Alpine it was a fun thing to try out and learn something new! FROM alpine:latest
RUN apk update && apk --no-cache add \ make mimalloc gcc zsh \ musl-fts-dev musl-dev flex indent xterm tcl-dev tk-dev openssl-dev pcre-dev font-dejavu
COPY . /usr/src/bacon WORKDIR /usr/src/bacon
#ALPINE mimalloc linked with libc.musl RUN LDFLAGS=-l:libmimalloc-secure.so.2 ./configure --enable-gui-tk
RUN make && make install WORKDIR /tmp
|
|
|
Post by Pjot on Mar 10, 2023 17:42:28 GMT 1
Thanks Joe, Nice! The 210Mb is as small as it can get, I suppose The '--no-cache add' option also makes a difference. It's cool that the Docker image for BaCon can get this small! BR Peter
|
|