Sign inSign up

vinniec/tinycore_vscodium

By vinniec

Updated about 5 years ago

Image containing tinycore 12, python 3.9, tk8.6 and vscodium 1.58.2 Based on bensuperpc hub image.

Image
0

278

vinniec/tinycore_vscodium repository overview

FILE KEPT UP TO DATE (v0.1.1.58.2)

To run the image:

xhost +
docker run -it --rm \
--net=host \
--env="DISPLAY=unix${DISPLAY}" \
--workdir /home/tc \
--volume="$HOME/.Xauthority:/root/.Xauthority:rw" \
--name tc_temp \
vinniec/tinycore_vscodium:latest

dockerfile

ARG IMGVERS=latest
FROM bensuperpc/tinycore:${IMGVERS}
LABEL maintainer "Vinnie Costante <[email protected]>"

ARG DOWNDIR=/tmp/download
ARG INSTDIR=/opt/vscodium
ARG LOCFONT=/home/tc/.local/share/fonts
ARG USERBIN=/home/tc/.local/bin
ARG CODESET=/home/tc/.config/VSCodium/User
ARG REPOAPI="https://api.github.com/repos/VSCodium/vscodium/releases/latest"
ARG HACKAPI="https://api.github.com/repos/source-foundry/Hack/releases/latest"

ENV LANG=C.UTF-8 LC_ALL=C PATH="${PATH}:${USERBIN}"

COPY codium ${USERBIN}/
COPY settings.json ${CODESET}/
RUN sudo mkdir -p ${DOWNDIR} ${INSTDIR} ${LOCFONT} \
    && sudo chown -R tc:staff ${DOWNDIR} ${INSTDIR} /home/tc/ \
    && chmod +x ${USERBIN}/codium \
    && tce-load -wic Xlibs wget nss gtk3 libasound libcups python3.9 tk8.6 \
    && rm -rf /tmp/tce/optional/* \
    && sudo ln -s /lib /lib64 \
    && sudo ln -s /usr/local/etc/fonts /etc/fonts \
    && wget -q -O - ${REPOAPI} | grep browser_download_url | grep linux-x64 | cut -d '"' -f 4 | head -n1 | xargs -n 1 wget -P ${DOWNDIR} \
    && tar xvf ${DOWNDIR}/VSCodium*.gz -C ${INSTDIR} \
    && wget -q -O - ${HACKAPI} | grep browser_download_url | grep "ttf.tar.gz" | cut -d '"' -f 4 | head -n1 | xargs -n 1 wget -O ${DOWNDIR}/hack.tgz \
    && tar xvf ${DOWNDIR}/hack.tgz -C ${DOWNDIR} \
    && cp ${DOWNDIR}/ttf/Hack-Regular.ttf ${LOCFONT}/ \
    && rm -rf ${DOWNDIR} \
    && sudo chown root /opt/vscodium/chrome-sandbox \
    && sudo chmod 4755 /opt/vscodium/chrome-sandbox \
    && fc-cache -f -v
CMD codium start

codium starting script

#!/bin/ash
#~ /opt/vscodium/bin/codium -w --no-sandbox

codexec='/opt/vscodium/bin/codium --no-sandbox'

if [ $1 = "start" ]; then
    $codexec
fi

while true; do
    reset
    cat <<\HEREDOC
For docker is important to keep the main process (PID 1) always open to not close the container killing the application (vscodium). Unfortunately also with the flag -w, vscodium still close itself when it open new editor view. It is possible to keep watching the file '.../*main.sock' (for example with inotifyd), but if vscodium crashes, this file remain there. So checking it is a wasting of resources. It is better to keep open a static menu like this with some options available:
    K) Killall codium
    D) Delete *main.sock
    S) Start codium
    P) open to container Prompt
    Q) Quit from the container
HEREDOC
    read -n1 -p "insert the corresponding UPPERCASE letter: " ans
    case $ans in
    K) echo; killall codium ;;
    D) echo; rm /home/tc/.config/VSCodium/*main.sock ;;
    S) echo; $codexec ;;
    P) echo; /bin/ash ;;
    Q) echo; exit ;;
    esac
  #condition || break
done

settings.json

{
    "editor.minimap.enabled": false,
    "workbench.startupEditor": "none",
    "window.dialogStyle": "custom",
    "window.titleBarStyle": "custom",
    "editor.fontFamily": "'Hack'",
    "editor.inlayHints.fontFamily": "'Hack'",
    "terminal.integrated.fontFamily": "'Hack'",
}
0.1.1.58.2

I did an update to fix some issues but all software is still at the same version:

  • when vscodium closed a window (even temporarily, like closing the last open tab) the container would close

  • to solve the problem now the shell is occupied by a menu with some features

  • added the font 'Hack', I'm afraid that the font in the unmodified version was not even monospace

  • set few default settings (blank page at startup, disabled minimap, changed font, 'custom' look of the menu style

  • started to insert the version number as tag (I hope) The dockerfile now copies the codium startup script and the initial configuration because it was becoming complex to quote everything directly into it. I will update in this readme these files along with the dockerfile.... I should really use github or something.

    first release (without version, like 0.0) This is my first docker image, I made it because I wanted to use vscodium on alpine linux host which as of now can't run applications in electron. I like minimal distributions and I already knew about tinycore so the idea was to use this distro for the image. Luckily I found a recent image already made on: https://hub.docker.com/r/bensuperpc/tinycore. My image includes vscodium, python3.9 and tk8.6 (I have fun with python).

If you want to save vscodium configurations you can use docker commits or you can create a volume that mounts the container home on a host dir, for example by adding this line to the docker run command: --volume="/home/user/dockerhome:/home/tc:rw". However the first time you add this option you should not associate it to the container path /home/tc because it would overwrite the container home and vscodium would not start. You must first associate it in another path (eg /tmp/home), start the container in the interactive shell (postponing the string /bin/ash at the end of the docker run command), copy all the contents of /home/tc in the new directory (as in the example /tmp/home, remember that in the host you must grant write rights to all users and groups for the linked directory, for example /home/user/dockerhome) and then close the container and restart it again with the exemplified --volume option that associates the home of the container.

Maybe in the future I will share more documentation on github, "happy hacking".

Tag summary

Content type

Image

Digest

Size

152.7 MB

Last updated

about 5 years ago

docker pull vinniec/tinycore_vscodium