Skip to content

Instantly share code, notes, and snippets.

@Sparticuz
Last active September 20, 2022 13:11
Show Gist options
  • Save Sparticuz/cdd77b48c0855b6b014ea8a129c71a6a to your computer and use it in GitHub Desktop.
Save Sparticuz/cdd77b48c0855b6b014ea8a129c71a6a to your computer and use it in GitHub Desktop.
lutris
#########################
# retroarch.yml
#########################
#
# This container runs RetroArch
services:
####################
lutris:
depends_on:
- sunshine
build:
context: ./images/
dockerfile: lutris/Dockerfile
# image: ghcr.io/games-on-whales/retroarch:edge
runtime: ${DOCKER_RUNTIME}
# network_mode: host
privileged: true
network_mode: ${UDEVD_NETWORK}
volumes:
# Followings are needed in order to get joystick support
- /dev/input:/dev/input:ro
- udev:/run/udev/:ro
# Xorg socket in order to get the screen
- ${XORG_SOCKET}:/tmp/.X11-unix
# Pulse socket, audio
- ${PULSE_SOCKET_HOST}:${PULSE_SOCKET_GUEST}
# Home directory: retroarch games, downloads, cores etc
- ${local_state}/:/home/retro/
# some emulators need more than 64 MB of shared memory - see https://github.com/libretro/dolphin/issues/222
# TODO: why shm_size doesn't work ??????
- type: tmpfs
target: /dev/shm
tmpfs:
size: ${SHM_SIZE}
ipc: ${SHARED_IPC} # Needed for MIT-SHM, removing this should cause a performance hit see https://github.com/jessfraz/dockerfiles/issues/359
env_file:
- config/common.env
- config/xorg.env
# run-gow: gpu_env
environment:
# Which devices does GoW need to be able to use? The docker user will be
# added to the groups that own these devices, to help with permissions
# issues
# These values are the defaults, but you can add others if needed
GOW_REQUIRED_DEVICES: /dev/uinput /dev/input/event* /dev/dri/* /dev/snd/*
FROM ubuntu:22.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ="Europe/London"
ENV UNAME retro
ENV HOME /home/$UNAME
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common sudo && \
# Install dependencies \
apt-get install -y --no-install-recommends gpg-agent pciutils dbus wget \
p7zip unrar libglu1-mesa && \
# cabextract curl glib2
# Install wine
wget -nc -O /usr/share/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key && \
wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2)/winehq-$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2).sources && \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --install-recommends wine-stable && \
# Install winetricks
wget -nv -O /usr/bin/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks && \
chmod +x /usr/bin/winetricks && \
# Install lutris \
apt-get install -y libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386
add-apt-repository ppa:lutris-team/lutris && \
apt-get install -y lutris \
# Install xdpyinfo so that we can wait for X11 on startup
x11-utils \
libglu1-mesa:i386 \
&& \
# \
# Cleanup \
apt-get remove -y software-properties-common && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Common scripts
COPY --chmod=777 common/* /bin/
# Set up the user
RUN setup-retro-user
WORKDIR $HOME
USER ${UNAME}
COPY lutris/scripts/startup.sh /startup.sh
ENV XDG_RUNTIME_DIR=/tmp/.X11-unix
ENV __NV_PRIME_RENDER_OFFLOAD 1
CMD /bin/bash /startup.sh
ARG IMAGE_SOURCE
LABEL org.opencontainers.image.source $IMAGE_SOURCE
#!/bin/bash
set -e
function LOG {
echo $(date -R): $0: $*
}
LOG "Waiting for X Server $DISPLAY to be available"
wait-x11
LOG_LEVEL=${LOG_LEVEL:-INFO}
LOG "Starting Lutris with DISPLAY=${DISPLAY} and LOG_LEVEL=${LOG_LEVEL}"
ensure-groups ${GOW_REQUIRED_DEVICES:-/dev/uinput /dev/input/event*}
#sleep 100000
# Start Retroarch. Use `sudo` to make sure that group membership gets reloaded
exec sudo -u $(whoami) -E /usr/games/lutris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment