1
0
mirror of https://github.com/pumpitupdev/pumptools.git synced 2024-11-27 16:10:55 +01:00
some tests based of references: docker image with simply docker run
command works with nx2, though no keyboard input or sound

using x11docker, it might be easier to get the missing features though
i still need to figure out how to get glxgears to work at least
This commit is contained in:
icex2 2021-02-27 00:34:52 +01:00
parent f0040e5a1a
commit d7b03a935a
5 changed files with 9120 additions and 2 deletions

View File

@ -18,7 +18,8 @@ RUN apt-get update && apt-get install -y \
libasound2-dev:i386 \
libconfig++-dev:i386 \
libx11-dev:i386 \
libcurl4-gnutls-dev:i386
libcurl4-gnutls-dev:i386 && \
rm -rf /var/lib/apt/lists/*
# Copy files for building to container
RUN mkdir /pumptools

View File

@ -117,4 +117,13 @@ something for pumptools.
## License
Source code license is the Unlicense; you are permitted to do with this as thou wilt. For details, please refer to the
[LICENSE file](LICENSE) included with the source code.
[LICENSE file](LICENSE) included with the source code.
## Docker notes
* What's the minimum driver version you need on the host? Is there also a maximum? -> offer different docker containers?
* nvidia driver in docker container needs to match host driver apparently? -> confirm this
* offer different dockerfiles with different nvidia versions
* libmesa better alternative here?
* dockerfile for sgl -> sgl repo
* for the nvidia dockerfiles you need nvidia-docker installed
* debugging container: check if GPU is accessible in container: `nvidia-smi`, `glxgears` to test 3d acceleration

51
dist/Dockerfile vendored Normal file
View File

@ -0,0 +1,51 @@
# Reference: https://gitlab.com/nvidia/container-images/samples/-/raw/master/opengl/ubuntu16.04/glxgears/Dockerfile
# Use a rather old version of ubuntu to ensure compatibility regarding libc
FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu16.04
LABEL description="Runtime environment for pump games with tools"
ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display
# Install build dependencies, multilib to get 32-bit versions
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y gcc-multilib
RUN apt-get install -y mesa-utils
RUN apt-get install -y libglu1-mesa:i386
RUN apt-get install -y libusb-0.1-4:i386
RUN apt-get install -y libconfig++9v5:i386
RUN apt-get install -y libxcursor1:i386
RUN apt-get install -y libxinerama1:i386
RUN apt-get install -y libxi6:i386
RUN apt-get install -y libxrandr2:i386
RUN apt-get install -y libxxf86vm1:i386
RUN apt-get install -y libx11-6:i386
RUN apt-get install -y libasound2:i386
RUN apt-get install -y libfreetype6:i386
RUN apt-get install -y libusb-1.0-0:i386
RUN apt-get install -y zlib1g:i386
RUN apt-get install -y libcurl4-gnutls-dev:i386
RUN apt-get install -y lib32tinfo5
RUN apt-get install -y lib32ncurses5
RUN apt-get install -y xorg
RUN apt-get install -y xinit
RUN apt-get install -y x11-xserver-utils
RUN apt-get install -y xserver-xorg-core
RUN apt-get install -y alsa-base
RUN apt-get install -y alsa-utils
RUN apt-get install -y alsa-tools
RUN apt-get install -y gdb
RUN apt-get install -y gdbserver
RUN apt-get install -y strace
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir /piu
WORKDIR /piu
ENTRYPOINT [ "xterm" ]
# TODO need a custom entry point that takes the game folder as an argument to run the run.sh script because we need the xsession etc

56
dist/piueb vendored
View File

@ -369,6 +369,54 @@ cmd_help()
print_usage
}
cmd_docker_build()
{
# TODO check if docker installed
docker rm -f pumptools-run
docker build -t pumptools:run .
docker create --name pumptools-run pumptools:run
}
cmd_docker_run()
{
# TODO check if docker installed
local game_data_path="$1"
local params_piueb="${@:2}"
if [ ! "$game_data_path" ]; then
log_error "No path to game data given"
exit 1
fi
local game_data_path_abs="$(realpath $game_data_path)"
if [ ! -d "$game_data_path_abs" ]; then
log_error "Game data path is either not a directory or does not exist: $game_data_path_abs"
exit 1
fi
log_debug "Path to game data for docker run: $game_data_path_abs"
log_info "Running in docker container..."
# Reference: https://gitlab.com/nvidia/container-images/samples/-/raw/master/opengl/ubuntu16.04/glxgears/Dockerfile
xhost +si:localuser:root
docker run \
-it \
--rm \
--privileged \
--gpus all \
-v /dev/bus/usb:/dev/bus/usb \
-v "$game_data_path_abs:/piu" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY \
pumptools:run \
/bin/bash
}
##################################################################################
CMD="$1"
@ -399,6 +447,14 @@ case $CMD in
cmd_run "valgrind" "${@:2}"
exit 0
;;
"docker-build")
cmd_docker_build
exit 0
;;
"docker-run")
cmd_docker_run "${@:2}"
exit 0
;;
*)
echo "Invalid command."
print_usage

9001
dist/x11docker vendored Executable file

File diff suppressed because it is too large Load Diff