Skip to content

Commit

Permalink
✨ feat(server): Add pulseaudio to capture sound (#10)
Browse files Browse the repository at this point in the history
## Description

**What(what issue does this code solve/what feature does it add):**
We do not have a way to capture sound inside the container.
**How(how does it solve it):**
1. Install pulseaudio inside the container
2. Add an entrypoint.sh where we start the pulseaudio
## Required Checklist:

- [ ] I have added any necessary documentation and comments in my code
(where appropriate)
- [ ] I have added tests to make sure my code runs in all contexts

## Further comments
  • Loading branch information
wanjohiryan authored Apr 3, 2024
1 parent 5492f22 commit b381e44
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

#Start pulseaudio
/usr/bin/pulseaudio --system --verbose --log-target=stderr --realtime=true --disallow-exit -F /etc/pulse/default.pa
48 changes: 0 additions & 48 deletions .scripts/gpu

This file was deleted.

16 changes: 13 additions & 3 deletions server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ENV XDG_RUNTIME_DIR=/run/user/1000/ \
WAYLAND_DISPLAY=wayland-0 \
PUID=0 \
PGID=0 \
HOME="/root" \
UNAME="root"

RUN apt-get update -y \
Expand Down Expand Up @@ -103,10 +104,19 @@ RUN apt-get update -y \
gamescope \
&& rm -rf /var/lib/apt/lists/*

COPY .scripts/ /usr/bin/netris/
#Install pulseaudio
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
alsa-utils \
libasound2 \
libasound2-plugins \
pulseaudio \
&& rm -rf /var/lib/apt/lists/* \
&& echo "load-module module-native-protocol-tcp auth-anonymous=1" >> /etc/pulse/default.pa

COPY .scripts/ /usr/bin/netris/
RUN ls -la /usr/bin/netris \
&& chmod +x /usr/bin/netris/proton
&& chmod +x /usr/bin/netris/proton /usr/bin/netris/entrypoint.sh

#Install proton
RUN /usr/bin/netris/proton -i
Expand All @@ -116,4 +126,4 @@ ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

CMD [ "/bin/bash" ]
CMD [ "/usr/bin/netris/entrypoint.sh" ]

0 comments on commit b381e44

Please sign in to comment.