FROM ubuntu:24.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
	apt-get install -y -q \
		curl git ca-certificates build-essential zlib1g-dev \
		libbz2-dev libssl-dev libreadline-dev libffi-dev \
		liblzma-dev libsqlite3-dev tk-dev \
		upx-ucl
RUN curl https://pyenv.run | bash

ENV PATH="/root/.pyenv/bin:$PATH"

RUN pyenv install -l | grep 3.13
RUN CONFIGURE_OPTS=--enable-shared pyenv install 3.13.14
RUN pyenv global 3.13.14

RUN /root/.pyenv/versions/3.13.14/bin/python -m venv /yacron2
ENV PATH=/yacron2/bin:$PATH
RUN pip install -U pip setuptools pyinstaller==6.21.0

COPY . /root/yacron2
WORKDIR /root/yacron2
RUN git status
RUN pip install .
# Best-effort, wheel-only: bundle uvloop so this (x86_64 glibc) local build gets
# the faster event loop too, mirroring the CI binary jobs. Falls back to asyncio
# if no wheel is available (yacron2/__main__._new_event_loop).
RUN pip install --only-binary=:all: "uvloop>=0.19" || echo "no uvloop wheel; using asyncio"
RUN python pyinstaller/yacron2 --version
RUN pyinstaller pyinstaller/yacron2.spec
RUN ls -sFh dist/yacron2
RUN dist/yacron2 --version
