Skip to content

Commit 5f05651

Browse files
authored
Merge pull request #18 from games-on-whales/sunshine-deb
Testing Sunshine .deb installation
2 parents 98e5080 + 0770331 commit 5f05651

File tree

7 files changed

+68
-36
lines changed

7 files changed

+68
-36
lines changed

docker-compose.yml

+34-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
version: "3.9"
22

33
services:
4-
4+
5+
##########################################
6+
# There's a lot going on in this file,
7+
# it's normal to get lost with all the options and variables
8+
#
9+
# Before diving in, make sure to take a look at the documentation.
10+
# in particular read the components-overview section (https://github.com/games-on-whales/gow/blob/master/docs/components-overview.md)
11+
# in order to get a view on how the components are tied together
12+
####################
13+
14+
15+
####################
516
# If you don't have a desktop environment we have to run Xorg
617
xorg:
718
build: ./images/xorg/
819
image: gameonwhales/xorg
9-
network_mode: host
20+
network_mode: host # Needed by uinput
1021
privileged: true
1122
volumes:
12-
# Shared with Sunshine in order to get mouse, joypad working
23+
# Shared with Sunshine in order to get mouse and joypad working
1324
- /dev/input:/dev/input:ro
1425
- /run/udev:/run/udev:ro
15-
#- /dev/shm:/dev/shm TODO
26+
# If you don't pass this it complains (but it runs anyway?) so probably it's not strictly needed
27+
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
1628
# The xorg socket, it'll be populated when up and running
1729
- xorg:/tmp/.X11-unix
30+
ipc: shareable # Needed for MIT-SHM, removing this should cause a performance hit see https://github.com/jessfraz/dockerfiles/issues/359
1831
environment:
1932
DISPLAY: ":0"
2033

34+
####################
2135
# If you don't have a pulse server start it
2236
pulse:
2337
depends_on:
@@ -36,6 +50,7 @@ services:
3650
environment:
3751
DISPLAY: ":0"
3852

53+
####################
3954
sunshine:
4055
depends_on:
4156
- xorg
@@ -52,34 +67,44 @@ services:
5267
- xorg:/tmp/.X11-unix
5368
# Home directory: sunshine state + configs
5469
- ${local_state}/:/home/retro/
70+
ipc: service:xorg # Needed for MIT-SHM, removing this should cause a performance hit see https://github.com/jessfraz/dockerfiles/issues/359
5571
environment:
5672
DISPLAY: ":0"
5773
LOG_LEVEL: info # Set to debug or verbose if you want to see more
5874
# Using network in order to connect to pulse
5975
# if you do have a pulse server already point this to the pulse socket like unix:/tmp/pulse-sock
6076
# and mount the host socket to the instance
61-
PULSE_SERVER: 127.0.0.1
62-
77+
PULSE_SERVER: 127.0.0.1
78+
79+
80+
####################
6381
retroarch:
6482
depends_on:
6583
- xorg
6684
- pulse
6785
- sunshine
6886
build: ./images/retroarch/
6987
image: gameonwhales/retroarch
88+
network_mode: host
89+
privileged: true
7090
volumes:
91+
# Followings are needed in order to get joystick support
92+
- /dev/input:/dev/input:ro
93+
- /run/udev:/run/udev:ro
94+
- /dev/uinput:/dev/uinput:ro
7195
# Xorg socket in order to get the screen
7296
- xorg:/tmp/.X11-unix
7397
# Home directory: retroarch games, downloads, cores etc
7498
- ${local_state}/:/home/retro/
99+
ipc: service:xorg # Needed for MIT-SHM, removing this should cause a performance hit see https://github.com/jessfraz/dockerfiles/issues/359
75100
environment:
76101
DISPLAY: ":0"
77-
LOG_LEVEL: info # Set to debug or verbose if you want to see more
78102
# Using network in order to connect to pulse
79103
# if you do have a pulse server already point this to the pulse socket like unix:/tmp/pulse-sock
80104
# and mount the host socket to the instance
81-
PULSE_SERVER: pulse
105+
PULSE_SERVER: 127.0.0.1
82106

107+
# ####################
83108
# An example of running an unprivileged X11 app in this environment
84109
# firefox:
85110
# depends_on:
@@ -98,6 +123,6 @@ services:
98123
# PULSE_SERVER: pulse # The name of the pulse container is the hostname in the virtual network
99124

100125

101-
126+
####################
102127
volumes:
103128
xorg: # This will hold the xorg socket file and it'll be shared between containers

images/retroarch/Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ RUN export UNAME=$UNAME UID=1000 GID=1000 && \
2424
mkdir -p /etc/sudoers.d && \
2525
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${UNAME} && \
2626
chmod 0440 /etc/sudoers.d/${UNAME} && \
27-
chown ${UID}:${GID} -R ${HOME}
27+
chown ${UID}:${GID} -R ${HOME} && \
28+
# messagebus is mapped to input this is needed in order to get joypad support TODO: double check this?
29+
usermod -a -G messagebus ${UNAME}
2830

2931

3032
WORKDIR $HOME
@@ -33,4 +35,6 @@ USER ${UNAME}
3335
COPY configs/retroarch.cfg /cfg/retroarch.cfg
3436
COPY scripts/startup.sh /startup.sh
3537

38+
ENV XDG_RUNTIME_DIR=/tmp/.X11-unix
39+
3640
CMD /bin/bash /startup.sh

images/retroarch/scripts/startup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ mkdir -p $HOME/retroarch/
99
cp -u /cfg/retroarch.cfg $HOME/retroarch/retroarch.cfg
1010

1111
# Start Sunshine
12-
/usr/bin/retroarch --config /home/retro/retroarch/retroarch.cfg
12+
/usr/bin/retroarch --config /home/retro/retroarch/retroarch.cfg #--verbose

images/sunshine/Dockerfile

+21-20
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,17 @@ ENV DEBIAN_FRONTEND=noninteractive
44
ENV TZ="Europe/London"
55

66
ENV UNAME retro
7-
8-
RUN apt-get update -y && apt-get install -y --no-install-recommends \
9-
# Sunshine dependencies, taken from sunshine/gen-deb.in
10-
# Depends: libssl1.1, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0, libboost-log1.67.0 | libboost-log1.71.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0
11-
libssl1.1 libavdevice58 libboost-thread1.71.0 libboost-filesystem1.71.0 libboost-log1.71.0 libpulse0 libopus0 libxcb-shm0 libxcb-xfixes0 libxtst6 \
12-
# Packages needed to build sunshine
13-
libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
14-
&& rm -rf /var/lib/apt/lists/*
7+
# Pulling latest Sunshine
8+
ARG SUNSHINE_SHA=c1697c8562ebd5a6e12ea5d6f5f72cc421120b71
9+
ENV SUNSHINE_SHA=${SUNSHINE_SHA}
1510

1611
######################################
1712
FROM base AS sunshine-builder
1813

19-
# Pulling Sunshine v0.7 with fixes for https://github.com/loki-47-6F-64/sunshine/issues/97
20-
ARG SUNSHINE_SHA=23b09e3d416cc57b812544c097682060be5b3dd3
21-
ENV SUNSHINE_SHA=${SUNSHINE_SHA}
22-
2314
RUN apt-get update -y && apt-get install -y --no-install-recommends \
24-
git ca-certificates apt-transport-https build-essential cmake \
15+
# Packages needed to build sunshine
16+
build-essential fakeroot gcc-10 g++-10 cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
17+
git ca-certificates apt-transport-https \
2518
&& rm -rf /var/lib/apt/lists/*
2619

2720
RUN git clone https://github.com/loki-47-6F-64/sunshine.git && \
@@ -34,12 +27,25 @@ RUN git clone https://github.com/loki-47-6F-64/sunshine.git && \
3427
git submodule update --init --recursive && \
3528
# Normal compile
3629
mkdir build && cd build && \
37-
cmake .. && \
38-
make -j ${nproc}
30+
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_EXECUTABLE_PATH=sunshine -DSUNSHINE_ASSETS_DIR=/etc/sunshine .. && \
31+
make -j ${nproc} && \
32+
# Generate the debian install package
33+
./gen-deb
3934

4035
######################################
4136
FROM base AS sunshine
4237

38+
# Get compiled sunshine
39+
COPY --from=sunshine-builder /sunshine/build/package-deb/sunshine.deb /sunshine.deb
40+
41+
# Install using the official .deb package
42+
# This will take care of installing the required dependencies
43+
RUN apt-get update -y && \
44+
apt-get install -y -f /sunshine.deb \
45+
# Seems that libgbm1 is missing
46+
&& apt-get install -y --no-install-recommends libgbm1 \
47+
&& rm -rf /var/lib/apt/lists/*
48+
4349
ENV HOME /home/$UNAME
4450
# Set up the user
4551
# Taken from https://github.com/TheBiggerGuy/docker-pulseaudio-example
@@ -56,11 +62,6 @@ RUN export UNAME=$UNAME UID=1000 GID=1000 && \
5662
WORKDIR $HOME
5763
USER ${UNAME}
5864

59-
# Get compiled sunshine
60-
COPY --from=sunshine-builder /sunshine/build/ /sunshine/
61-
COPY --from=sunshine-builder /sunshine/assets/ /sunshine/assets
62-
63-
6465
# Config files
6566
COPY configs/sunshine.conf /cfg/sunshine.conf
6667
COPY configs/apps.json /cfg/apps.json

images/sunshine/scripts/startup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ cp -u /cfg/sunshine.conf $HOME/sunshine/sunshine.conf
99
cp -u /cfg/apps.json $HOME/sunshine/apps.json
1010

1111
# Start Sunshine
12-
/sunshine/sunshine \
12+
sunshine \
1313
min_log_level=$LOG_LEVEL \
1414
${HOME}/sunshine/sunshine.conf

images/xorg/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ COPY scripts/startup.sh /startup.sh
2626

2727
COPY configs/desktop.jwmrc.xml /root/.jwmrc
2828

29+
ENV XDG_RUNTIME_DIR=/tmp/.X11-unix
30+
2931
CMD /bin/bash /startup.sh

images/xorg/configs/xorg.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Section "Screen"
2020
EndSubSection
2121
EndSection
2222

23-
# MIT-SHM cause trouble with docker-compose TODO!
24-
Section "Extensions"
25-
Option "MIT-SHM" "Disable"
26-
EndSection
23+
# MIT-SHM, disable this if you don't want to share memory between containers
24+
# Section "Extensions"
25+
# Option "MIT-SHM" "Disable"
26+
# EndSection

0 commit comments

Comments
 (0)