winzik/docker/standalone/Dockerfile
David Nurdin c8337fd01f A game as one executable: bin/jumphp export:standalone (StaticPHP micro with SDL, OpenGL, OpenAL + the game as a PHAR)
- docker/standalone: StaticPHP v3 (pinned) and JumPHP's registry: SDL2, SDL2_image, SDL2_mixer, SDL2_ttf,
  OpenAL Soft static; php-sdl, sdl_image, sdl_mixer, sdl_ttf, PHP-OpenGL (JumPHP's patch), PHP-OpenAL built in
- Linux: glibc 2.17 (Zig); X11, ALSA, PulseAudio and OpenGL loaded from the player's system (OpenGL through
  SDL_GL_GetProcAddress, nothing linked); tested with Pong and 3D Jumpball (23 MB each)
- Windows: config.w32 of the extensions and the workflow .github/workflows/standalone.yml (run by hand) that
  publishes both micros as the release standalone-<key>; export:standalone downloads them
- docs/standalone.md, README, AGENTS.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:52:36 +01:00

20 lines
1.5 KiB
Docker

# Standalone games (bin/jumphp export:standalone): static-php-cli (StaticPHP v3, pinned) builds PHP's micro SAPI
# with JumPHP's extensions (SDL2 and its add-ons, OpenGL, OpenAL: the registry in docker/standalone/registry);
# the game is appended to it as a PHAR: one executable. Linux: glibc 2.17 (Zig), the display and the sound loaded
# from the player's system at launch.
FROM php:8.4-cli-bookworm
ARG SPC_REF=39e0b8a
COPY spc-registries.php /tmp/
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl unzip xz-utils make autoconf automake libtool pkg-config bison re2c patch file flex gperf autopoint \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxinerama-dev libxfixes-dev \
libgl-dev libegl-dev libasound2-dev libpulse-dev \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL -A jumphp-standalone -o /usr/local/bin/composer https://getcomposer.org/download/2.8.12/composer.phar \
&& chmod 755 /usr/local/bin/composer \
&& curl -fsSL -A jumphp-standalone https://github.com/Kitware/CMake/releases/download/v3.31.8/cmake-3.31.8-linux-x86_64.tar.gz \
| tar -xz -C /opt && ln -sf /opt/cmake-3.31.8-linux-x86_64/bin/cmake /usr/local/bin/cmake \
&& git clone -q https://github.com/crazywhalecc/static-php-cli.git /opt/spc && cd /opt/spc && git checkout -q "$SPC_REF" \
&& composer install -q --no-dev --no-interaction && php /tmp/spc-registries.php \
&& ln -s /opt/spc/bin/spc /usr/local/bin/spc && spc --version && chmod -R a+rwX /opt/spc
WORKDIR /opt/spc