# Release builds for Linux. Ubuntu 22.04's glibc 2.35 keeps the binary runnable on
# Debian 12, Ubuntu 22.04+, Mint 21+, Fedora and Arch.
FROM docker.io/library/ubuntu:22.04
ARG RUST_VERSION=1.99.1
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      ca-certificates curl file build-essential pkg-config \
      libasound2-dev libfontconfig1-dev libxkbcommon-dev libwayland-dev \
      libx11-dev libx11-xcb-dev libxcursor-dev libxi-dev libxrandr-dev libxcb1-dev \
      libegl1-mesa-dev libgl1-mesa-dev \
 && rm -rf /var/lib/apt/lists/*
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
  | sh -s -- -y --profile minimal --component clippy,rustfmt --default-toolchain "$RUST_VERSION"
# AppImage tooling, pinned by tag and SHA-256. The runtime is passed as a file so appimagetool
# never downloads one; it is static, so users need FUSE 3 but not libfuse2.
ARG APPIMAGETOOL=1.9.1
ARG APPIMAGETOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0
ARG RUNTIME=20251108
ARG RUNTIME_SHA256=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d
RUN curl -fsSLo /opt/appimagetool https://github.com/AppImage/appimagetool/releases/download/$APPIMAGETOOL/appimagetool-x86_64.AppImage \
 && curl -fsSLo /opt/runtime-x86_64 https://github.com/AppImage/type2-runtime/releases/download/$RUNTIME/runtime-x86_64 \
 && echo "$APPIMAGETOOL_SHA256  /opt/appimagetool" | sha256sum -c - \
 && echo "$RUNTIME_SHA256  /opt/runtime-x86_64" | sha256sum -c - \
 && chmod +x /opt/appimagetool
ENV APPIMAGE_EXTRACT_AND_RUN=1
WORKDIR /src
