add cool-retro-term

This commit is contained in:
Andy 2017-01-23 23:47:50 +01:00
parent 685348eabc
commit d249f6b0a6
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC
3 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,49 @@
FROM ubuntu:xenial
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
# To avoid problems with Dialog and curses wizards
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y --no-install-recommends install ca-certificates wget git \
openssh-client sudo libpulse0 \
build-essential qmlscene \
qt5-qmake qt5-default qtdeclarative5-dev qtdeclarative5-controls-plugin \
qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects \
qtdeclarative5-dialogs-plugin qtdeclarative5-localstorage-plugin \
qtdeclarative5-window-plugin && \
rm -rf /var/lib/apt/lists/*
ENV DUSER user
ENV DGROUPS video,audio
ENV DUID 1000
ENV DHOME /home/$DUSER
ENV APPDIR /opt/cool-retro-term
RUN useradd -u $DUID -m -d $DHOME -s /usr/sbin/nologin -G $DGROUPS $DUSER && \
mkdir -p $APPDIR && \
chown -Rh $DUSER:$DUSER $APPDIR
WORKDIR $DHOME
USER $DUSER
RUN git clone --recursive https://github.com/Swordfish90/cool-retro-term.git $APPDIR
RUN cd $APPDIR && \
qmake && \
make -j $(nproc)
USER root
# You can install more apps you need here
# E.g.:
# RUN apt-get update && apt -y install pulseaudio-utils alsa-utils mplayer
# Workaround: pulseaudio client library likes to remove /dev/shm/pulse-shm-*
# files created by the host, causing sound to stop working.
# To fix this, we either want to disable the shm or mount /dev/shm
# in read-only mode when starting the container.
RUN echo "enable-shm = no" | sudo tee -a /etc/pulse/client.conf
COPY launch /launch
ENTRYPOINT [ "bash", "/launch" ]

View File

@ -0,0 +1,25 @@
version: '2'
services:
cool-retro-term:
image: andrey01/cool-retro-term
network_mode: bridge
devices:
- /dev/dri
# - /dev/video0
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:ro
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse:ro
- /etc/localtime:/etc/localtime:ro
- $HOME:/home/$USER
- /etc/machine-id:/etc/machine-id:ro
environment:
- DISPLAY=unix$DISPLAY
- PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native
- REALUSER=$USER
shm_size: 16M
# For the mplayer to work, you need to share IPC between host and the container
# otherwise you gonna get errors like:
# - X11 error: BadAccess (attempt to access private resource denied)
# - X11 error: BadShmSeg (invalid shared segment parameter)
ipc: host

14
cool-retro-term/launch Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
export OLDUSER=${DUSER:-user}
export USER=${REALUSER:?}
groupmod --new-name $USER $(id -gn $OLDUSER)
usermod --home /home/$USER $OLDUSER
usermod --login $USER $OLDUSER
echo "$USER ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/$USER
sudo PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER
# QT_X11_NO_MITSHM - stops Qt form using the MIT-SHM X11 extension
# sudo QT_X11_NO_MITSHM=${QT_X11_NO_MITSHM:-1} PULSE_SERVER=${PULSE_SERVER:?} su -s /bin/bash -c /opt/cool-retro-term/cool-retro-term $USER