# this work is based on https://github.com/bbusse/swayvnc FROM ubuntu:latest ARG flutter_version WORKDIR /usr ENV FLUTTER_HOME=/usr/flutter/bin ENV PATH=${FLUTTER_HOME}:${PATH} ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 LABEL maintainer="The one with the braid " ENV USER="vnc-user" \ VNC_LISTEN_ADDRESS="0.0.0.0" \ VNC_AUTH_ENABLE="false" \ VNC_KEYFILE="key.pem" \ VNC_CERT="cert.pem" \ VNC_PASS="$(pwgen -yns 8 1)" COPY selections.conf selections.conf RUN apt update && apt install debconf-utils && dpkg-reconfigure debconf -f noninteractive -p critical \ && debconf-set-selections < selections.conf RUN apt upgrade -y RUN apt install -y openssl socat sway keyboard-configuration wayvnc libneatvnc0 \ clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev git unzip foot curl # Add application user RUN groupadd --gid 3434 $USER \ && useradd --uid 3434 --gid $USER --groups sudo,video,audio --shell /bin/bash --create-home $USER \ && (echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers) # Make sure we have UTF-8 RUN echo "LC_ALL=en_US.UTF-8" > /etc/environment \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ && echo "LANG=en_US.UTF-8" > /etc/locale.conf # && locale-gen en_US.UTF-8 # Copy sway config COPY config /etc/sway/config # Add wayvnc to compositor startup and put IPC on the network RUN mkdir -p /etc/sway/config.d \ && echo "exec wayvnc 0.0.0.0 5900" >> /etc/sway/config.d/exec \ && echo "exec \"socat TCP-LISTEN:7023,fork UNIX-CONNECT:/tmp/sway-ipc.sock\"" >> /etc/sway/config.d/exec \ && mkdir -p /home/$USER/.config/wayvnc/ \ && printf "\ address=$VNC_LISTEN_ADDRESS\n\ enable_auth=$VNC_AUTH_ENABLE\n\ username=$USER\n\ password=$VNC_PASS\n\ private_key_file=/home/$USER/$VNC_KEYFILE\n\ certificate_file=/home/$USER/$VNC_CERT" > /home/$USER/.config/wayvnc/config # Generate certificates for VNC RUN openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ -keyout key.pem -out cert.pem -subj /CN=localhost \ -addext subjectAltName=DNS:localhost,DNS:localhost,IP:127.0.0.1 RUN mkdir -p /usr/flutter && chown -R $USER /usr/flutter RUN mkdir -p /home/$USER/.config && chown -R $USER /home/$USER/ USER $USER ENV HOME /home/$USER ENV PATH /home/$USER/.local/bin:/home/$USER/bin:${PATH} RUN git clone --depth 1 https://github.com/flutter/flutter.git -b $flutter_version /usr/flutter RUN flutter config --no-analytics && flutter precache --linux && flutter doctor # Add entrypoint COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] WORKDIR /opt