m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.95k stars 449 forks source link

Docker build - base question #303

Closed NN-Binary closed 1 year ago

NN-Binary commented 1 year ago

Hello!

I'm trying to change a few things in .docker and build, no issues so far, but when I inspect file .docker/brave/Dockerfile for example, I see

ARG BASE_IMAGE=m1k1o/neko:base
FROM $BASE_IMAGE

How do I specify the BASE_IMAGE as the one from .docker? So it doesn't go online.

m1k1o commented 1 year ago

Hello, if that image is available locally it won't go online. So if you build local image with extactly that name, it will be used. e.g.: docker build -t m1k1o/neko:base .

You can use ./build base and ./build brave scripts, they do exactly what you want.

NN-Binary commented 1 year ago

Thank you! Indeed yes, I didn't know that it will choose local first if it's already available.

NN-Binary commented 1 year ago

May I ask one last detail

command=/usr/bin/code --x11-display=%(ENV_DISPLAY)s --no-qt-privacy-ask %(ENV_VLC_MEDIA)s

What is the s in the end?

m1k1o commented 1 year ago

That is just supervisord syntax for passing variables:

%(ENV_X)s. where X is name of the environment variable.

NN-Binary commented 1 year ago

Awesome! Thank you so much for helping

NN-Binary commented 1 year ago

I'm sorry, I don't want to abuse your time, I'm doing a lot of research but can't seem to figure out a weird bug. I'm actively trying to have Visual studio code (code) running, it does work, but constantly "restart" by itself

I can see VSCode literally started, then it closes and infinitely restarts. I could open a new issue but I have a feeling it's just my limited docker knowledges that cause this issue

[program:code]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
command=/usr/bin/code --disable-extensions --window-position=0,0 --no-first-run --start-maximized  --disable-software-rasterizer --disable-gpu --display=%(ENV_DISPLAY)s
stopsignal=INT
autorestart=true
priority=800
user=%(ENV_USER)s
stdout_logfile=/var/log/neko/vscode.log
stdout_logfile_maxbytes=100MB
stdout_logfile_backups=10
redirect_stderr=true

[program:openbox]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
command=/usr/bin/openbox --config-file /etc/neko/openbox.xml
autorestart=true
priority=300
user=%(ENV_USER)s
stdout_logfile=/var/log/neko/openbox.log
stdout_logfile_maxbytes=100MB
stdout_logfile_backups=10
redirect_stderr=true
ARG BASE_IMAGE=m1k1o/neko:base
FROM $BASE_IMAGE

ARG SRC_URL="https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"

#
# install VScode
RUN set -eux; apt-get update; \
    wget -O /tmp/vscode.deb "${SRC_URL}"; \
    apt-get install -y gnupg openbox /tmp/vscode.deb; \
    #
    # clean up
    apt-get clean -y; \
    rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#

#
# copy configuation files
COPY supervisord.conf /etc/neko/supervisord/vscode.conf
COPY openbox.xml /etc/neko/openbox.xml

Docker logs:

2023-04-29 18:40:49,054 INFO success: code entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-29 18:40:49,068 DEBG fd 19 closed, stopped monitoring <POutputDispatcher at 140219685932768 for <Subprocess at 140219686447088 with name code in state RUNNING> (stdout)>
2023-04-29 18:40:49,068 INFO exited: code (exit status 0; expected)
2023-04-29 18:40:49,068 DEBG received SIGCHLD indicating a child quit
2023-04-29 18:40:50,072 INFO spawned: 'code' with pid 16283
2023-04-29 18:40:50,073 INFO reaped unknown pid 16181 (exit status 0)
2023-04-29 18:40:50,073 INFO reaped unknown pid 16156 (exit status 0)
2023-04-29 18:40:50,073 INFO reaped unknown pid 16210 (exit status 1)
2023-04-29 18:40:50,073 INFO reaped unknown pid 16159 (exit status 0)
2023-04-29 18:40:50,073 INFO reaped unknown pid 16160 (exit status 0)
2023-04-29 18:40:50,073 DEBG received SIGCHLD indicating a child quit

Count on me for a donation :)

m1k1o commented 1 year ago

You need to add --wait, it want to start in background. Here is working example, hope it hepls: https://github.com/m1k1o/neko-apps/blob/master/vscode/supervisord.conf

NN-Binary commented 1 year ago

Thanks so much! You made my day