# Copyright (C) 2026 Andrija Petrovic
# SPDX-License-Identifier: GPL-3.0-or-later

# The machine that builds PlayIt's libmpv for Android (tools/android-libmpv/
# build.sh). Ubuntu 22.04, which is what media_kit's own build ran on, at one
# fixed image and with every package as it was on one fixed day in Ubuntu's
# snapshot archive: the same tools on every build machine, whenever it is
# built.
FROM ubuntu@sha256:5ec03bb3441e8b0bf3b4f9cd4629a1ae763010dc3035bb8da3ae6cf026486401
ARG SNAPSHOT=20261001T000000Z
# The snapshot archive answers over HTTPS only, and the bare image has no
# certificate authorities: they come from the ordinary archive first (which
# moves), and then everything, they too, is set to the snapshot's version,
# up or down (the preference of 1001 allows down).
RUN set -eux; \
    export DEBIAN_FRONTEND=noninteractive; \
    apt-get update; \
    apt-get install -y --no-install-recommends ca-certificates; \
    for suite in jammy jammy-updates jammy-security; do \
        echo "deb https://snapshot.ubuntu.com/ubuntu/$SNAPSHOT $suite main universe"; \
    done > /etc/apt/sources.list; \
    printf 'Package: *\nPin: release o=Ubuntu\nPin-Priority: 1001\n' > /etc/apt/preferences.d/snapshot; \
    apt-get -o Acquire::Check-Valid-Until=false update; \
    apt-get dist-upgrade -y --allow-downgrades; \
    apt-get install -y --no-install-recommends --allow-downgrades \
        binutils bzip2 ca-certificates file gcc libc6-dev make meson nasm ninja-build \
        patch perl pkg-config python3 python3-jinja2 python3-jsonschema unzip xz-utils; \
    rm -rf /var/lib/apt/lists/*; \
    dpkg-query -W -f '${Package} ${Version}\n' > /packages.txt
ENV LC_ALL=C.UTF-8 TZ=UTC
