Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Added dbus xvfb and pulseaudio services
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjohiryan authored Sep 24, 2023
1 parent ac24ba2 commit 49957f2
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 11 deletions.
32 changes: 22 additions & 10 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,30 @@ RUN apt-get update; \
/usr/share/man/* \
/usr/share/local/*



#
# Install locales to prevent X11 errors
#
RUN apt-get clean && \
apt-get update && apt-get install --no-install-recommends -y locales && \
rm -rf /var/lib/apt/lists/* && \
locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TZ UTC

#
#Add xserver and pulseaudio
#Add dependencies
#
RUN apt-get update; \
apt-get upgrade; \
apt-get install -y --no-install-recommends \
#
#Xserver
xorg openbox \
#Xserver
wget ca-certificates xvfb dbus-user-session dbus-x11 libdbus-c++-1-0v5 xorg openbox\
#
#Pulseaudio
pulseaudio; \
pulseaudio libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6; \
#
# Housekeeping
#
Expand Down Expand Up @@ -112,6 +121,7 @@ RUN apt-get update && apt-get install -y curl; \
# Add user "admin" to the Docker group
#
usermod -a -G docker admin

ADD https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker /etc/bash_completion.d/docker.sh

#
Expand All @@ -136,9 +146,9 @@ RUN chmod +x /scripts/ffmpeg.sh /usr/bin/warp
#
#Copy the systemd.service file for starting the server
#
COPY docker/base/warp.service /lib/systemd/system/
RUN ln -sf /lib/systemd/system/server.service \
/etc/systemd/system/multi-user.target.wants/server.service
COPY docker/base/*.service /lib/systemd/system/
RUN ln -sf /lib/systemd/system/*.service \
/etc/systemd/system/multi-user.target.wants/*.service

#
# For ssh, and http3 connections respectively
Expand All @@ -154,7 +164,9 @@ RUN ln -sf /lib/systemd/system/server.service \
#the volume that houses the key and cert files as `/certs/key.pem` and `/certs/cert.pem`
VOLUME [ "/certs" ]

ENV DISPLAY=:0
ENV DISPLAY :0
ENV DPI 96
ENV CDEPTH 24

#
# Set systemd as entrypoint.
Expand Down
16 changes: 16 additions & 0 deletions docker/base/dbus.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=dbus
After=docker.service
StartLimitIntervalSec=0

[Service]
ExecStart=/usr/bin/dbus
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=dbus-daemon
User=root

[Install]
WantedBy=multi-user.target
5 changes: 4 additions & 1 deletion docker/base/ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ WARP_SERVER_PORT="${WARP_SERVER_PORT:-4443}"
#Full server url
WARP_SERVER_FULL_URL="${WARP_SERVER_URL}:${WARP_SERVER_PORT}"


# Wait for X11 to start
echo "Waiting for X socket"
until [ -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]; do sleep 1; done
echo "X socket is ready"

CMD=(
ffmpeg
Expand Down
16 changes: 16 additions & 0 deletions docker/base/pulseaudio.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Pulseaudio server
After=docker.service
StartLimitIntervalSec=0

[Service]
ExecStart=/usr/bin/pulseaudio --log-level=info --disallow-module-loading --disallow-exit --exit-idle-time=-1
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=pulseaudio
User=admin

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions docker/base/xserver.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Xvfb server
After=docker.service
StartLimitIntervalSec=0

[Service]
ExecStart=/usr/bin/Xvfb "${DISPLAY}" -ac -screen "0" "8192x4096x${CDEPTH}" -dpi "${DPI}"
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=xvfb-server
User=admin

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions sysbox-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

#Make the amd gpu available inside the container
#chmod -R 777 /dev/dri

#
#This script is for anyone who has trouble installing sybox on their system
#
Expand Down

0 comments on commit 49957f2

Please sign in to comment.