# Builds the Sculpt Engine / Project Cold Water native Linux client as an AppImage. # Ubuntu 22.04 (glibc 2.35) keeps the resulting AppImage runnable on most modern distros. FROM ubuntu:22.04 AS builder ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential curl ca-certificates pkg-config file patchelf python3 wget \ libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev \ libx11-dev libxcursor-dev libxi-dev libxrandr-dev libxkbcommon-x11-dev \ libvulkan-dev libgl1-mesa-dev \ && rm -rf /var/lib/apt/lists/* RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable ENV PATH="/root/.cargo/bin:${PATH}" WORKDIR /app COPY Cargo.toml Cargo.lock ./ COPY src ./src COPY tests ./tests COPY shaders ./shaders COPY mods ./mods COPY scripts/appimage ./scripts/appimage RUN cargo build --release --bin project_cold_water # Assemble AppDir RUN set -eux; \ APPDIR=/app/AppDir; \ mkdir -p $APPDIR/usr/bin $APPDIR/usr/lib $APPDIR/usr/share/sculpt-engine; \ cp target/release/project_cold_water $APPDIR/usr/bin/project_cold_water; \ cp -r mods $APPDIR/usr/share/sculpt-engine/mods; \ cp scripts/appimage/AppRun $APPDIR/AppRun; chmod +x $APPDIR/AppRun; \ cp scripts/appimage/sculpt-engine.desktop $APPDIR/sculpt-engine.desktop; \ python3 scripts/appimage/make_icon.py $APPDIR/sculpt-engine.png; \ ln -s sculpt-engine.png $APPDIR/.DirIcon; \ # Bundle libasound (cpal links it at build time); GPU/Wayland/X11 libs are dlopen'd from the host. cp -L "$(ldconfig -p | awk '/libasound\.so\.2 /{print $NF; exit}')" $APPDIR/usr/lib/; \ patchelf --set-rpath '$ORIGIN/../lib' $APPDIR/usr/bin/project_cold_water; \ ldd $APPDIR/usr/bin/project_cold_water # Package with appimagetool (extract-and-run: no FUSE inside containers) RUN set -eux; \ wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O /tmp/appimagetool; \ chmod +x /tmp/appimagetool; \ mkdir -p /out; \ ARCH=x86_64 /tmp/appimagetool --appimage-extract-and-run /app/AppDir /out/SculptEngine-x86_64.AppImage; \ ls -la /out FROM scratch AS export COPY --from=builder /out/SculptEngine-x86_64.AppImage /SculptEngine-x86_64.AppImage