FROM debian:latest
ARG DEBIAN_FORNTEND=noninteractive

# Install the dev dependencies for GNU Guile
RUN apt update && \
    apt install -y \
        build-essential \
        wget \
        autoconf \
        autopoint \
        libtool \
        flex \
        pkg-config \
        gperf \
        libgmp-dev \
        libunistring-dev \
        libffi-dev \
        libgc-dev \
        texinfo

# Add a user 'alice' and switch to them
RUN useradd -m -s /bin/bash alice
USER alice
WORKDIR /home/alice
# Obtain the sources
mkdir .local
RUN wget -qO- https://codeberg.org/guile/guile/archive/main.tar.gz | tar xvf -
# Run autogen
WORKDIR /home/alice/guile
sh -x autogen.sh
mkdir build
# Run configure, make, and make install in $HOME/.local
WORKDIR /home/alice/guile/build
../configure --prefix=/home/alice/.local
make && make install
# Run guile --version for the installed guile
ENTRYPOINT ["/home/alice/.local/bin/guile", "--version"]
