# with debian:10 Rust has linking problems, see this description:
# https://github.com/rust-lang/rust/issues/79946#issuecomment-1693289299
FROM debian:11-slim

ARG APPLGRID_V=1.6.36
ARG CARGOC_V=0.10.3
ARG FASTNLO_V=2.5.0-2826
ARG LHAPDF_V=6.5.4
ARG ZLIB_V=1.3.1

# the last version is the default Rust version used in the container
# as long as we're using `persist-doctests` in the `Rust` workflow we need nightly as default
ARG RUST_V="1.70.0 1.80.1 nightly-2024-09-04"

ENV APPL_IGRID_DIR="/usr/local/src/applgrid-${APPLGRID_V}/src"
ENV CARGO_HOME="/usr/local/cargo"
ENV PATH="/usr/local/cargo/bin:${PATH}"
ENV RUSTUP_HOME="/usr/local/rustup"

COPY script.sh /tmp/

RUN mkdir /build && cd build && /tmp/script.sh && rm /tmp/script.sh && cd / && rm -r /build
