ソースを参照

Mise à jour de 'Dockerfile'

penta 4 日 前
コミット
af6827099b
1 ファイル変更32 行追加9 行削除
  1. 32 9
      Dockerfile

+ 32 - 9
Dockerfile

@@ -7,7 +7,8 @@
 
 ARG DISTRIB_RELEASE=24.04
 ARG SELKIES_IMAGE=ghcr.io/selkies-project/selkies/py-build:main
-ARG SELKIES_JS_IMAGE=ghcr.io/selkies-project/selkies/js-interposer:main-ubuntu24.04
+
+ARG SELKIES_GIT_REF=main
 ARG NVIDIA_VAAPI_DRIVER_VERSION=latest
 
 
@@ -22,7 +23,32 @@ FROM ${SELKIES_IMAGE} AS selkies-build
 # Selkies joystick interposer
 # -----------------------------------------------------------------------------
 
-FROM ${SELKIES_JS_IMAGE} AS selkies-js-interposer
+# Build the Selkies joystick interposer directly from its official source.
+FROM docker.io/library/ubuntu:${DISTRIB_RELEASE} AS selkies-js-interposer-builder
+
+ARG DEBIAN_FRONTEND=noninteractive
+ARG SELKIES_GIT_REF
+
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+
+RUN apt-get update \
+    && apt-get install --no-install-recommends -y \
+        build-essential \
+        ca-certificates \
+        curl \
+    && rm -rf /var/lib/apt/lists/*
+
+RUN set -eux; \
+    curl -fsSL \
+        "https://raw.githubusercontent.com/selkies-project/selkies/${SELKIES_GIT_REF}/addons/js-interposer/joystick_interposer.c" \
+        -o /tmp/joystick_interposer.c; \
+    install -d -m 0755 /out; \
+    gcc -shared -fPIC -O2 \
+        -Wl,-z,relro,-z,now \
+        -o /out/selkies_joystick_interposer.so \
+        /tmp/joystick_interposer.c \
+        -ldl; \
+    file /out/selkies_joystick_interposer.so
 
 
 # -----------------------------------------------------------------------------
@@ -366,14 +392,11 @@ RUN python3 -m venv /opt/selkies \
         /tmp/selkies-*.whl \
     && rm -f /tmp/selkies-*.whl
 
-# Preserve browser gamepad support from the original image.
-COPY --from=selkies-js-interposer /opt/*.deb /tmp/selkies-js-interposer.deb
+COPY --from=selkies-js-interposer-builder \
+    /out/selkies_joystick_interposer.so \
+    /usr/local/lib/selkies_joystick_interposer.so
 
-RUN apt-get update \
-    && apt-get install --no-install-recommends -y \
-        /tmp/selkies-js-interposer.deb \
-    && rm -f /tmp/selkies-js-interposer.deb \
-    && rm -rf /var/lib/apt/lists/*
+RUN chmod 0755 /usr/local/lib/selkies_joystick_interposer.so
 
 # Create the regular desktop user. sudo-root is kept because Xorg and the
 # NVIDIA userspace installer need a few targeted root operations at runtime.