chore(client): Update Dockerfile configuration

Refactor Dockerfile to remove redundant chown command and improve file copying efficiency. Ensure proper ownership of minetest configuration file.
This commit is contained in:
Yves-Marie Haussonne 2024-09-30 15:46:14 +02:00
parent da790eec8e
commit 89c6b4d62f
3 changed files with 33 additions and 4 deletions

View File

@ -57,7 +57,7 @@ RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc luajit irrlicht x11
WORKDIR /var/lib/minetest
COPY --chown=minetest:minetest <<EOF /var/lib/minetest/.minetest/minetest.conf
COPY <<EOF /var/lib/minetest/.minetest/minetest.conf
enable_fog = false
leaves_style = opaque
smooth_lighting = false
@ -73,9 +73,10 @@ COPY --chown=minetest:minetest <<EOF /var/lib/minetest/.minetest/minetest.conf
fullscreen_bpp = 8
fov = 45
video_driver = opengl
EOF
RUN chown minetest:minetest /var/lib/minetest/.minetest/minetest.conf
USER minetest:minetest
ENV \

View File

@ -6,8 +6,13 @@ rm -f /tmp/.X1-lock
# Start Xvfb
echo "Starting Xvfb"
Xvfb $DISPLAY -ac -screen 0 800x600x16 2>&1 &
xvfb_pid=$!
Xvfb $DISPLAY -ac -screen 0 "$XVFB_WHD" -nolisten tcp +extension GLX +render -noreset &
xvfb_pid="$!"
echo "Waiting for Xvfb (PID: $Xvfb_pid) to be ready..."
while ! xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; do
sleep 0.1
done
echo "Xvfb is running."
# prevent spikes if you spawn many containers simultaneously
sleep $((2 + $RANDOM % 6))

View File

@ -0,0 +1,23 @@
#!/bin/sh
if [ $# -eq 0 ]; then
echo "No command was given to run, exiting."
exit 1
else
# Start Xvfb
echo "Starting Xvfb"
Xvfb :99 -ac -screen 0 "$XVFB_WHD" -nolisten tcp +extension GLX +render -noreset &
Xvfb_pid="$!"
echo "Waiting for Xvfb (PID: $Xvfb_pid) to be ready..."
while ! xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; do
sleep 0.1
done
echo "Xvfb is running."
# Execute passed command.
"$@"
trap "echo 'Stopping'; kill -SIGTERM $Xvfb_pid" SIGINT SIGTERM
# Wait for process to end.
kill $Xvfb_pid
echo "Waiting for Xvfb (PID: $Xvfb_pid) to shut down..."
wait $Xvfb_pid
fi