# Image of the GitLab runner of culebrONT (CI, .gitlab-ci.yml): Python 3.12, apptainer and the apptainer images of
# the tools, downloaded once here from itrop so that the jobs do not download them ('culebrONT install --sif-dir').
# Rebuild and push it when the images change (TOOLS_IMAGE_TAG in culebrONT/global_variables.py):
#   podman build -t registry.forge.ird.fr/diade/culebront_pipeline/podman/gitlab-runner:<tag> -f Dockerfile_test .
#   podman push registry.forge.ird.fr/diade/culebront_pipeline/podman/gitlab-runner:<tag>

FROM ubuntu:24.04
USER root

ARG IMAGE_TAG=tools-1.0-dev
ARG IMAGES_URL=https://itrop.ird.fr/culebront_utilities/container_build

ENV DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 LANG=C.UTF-8 TZ=Europe/Paris
RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates curl wget git unzip software-properties-common \
        python3.12 python3.12-venv python3.12-dev build-essential \
    && add-apt-repository -y ppa:apptainer/ppa && apt-get update && apt-get install -y apptainer \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Python environment of the jobs (culebrONT is installed from the checkout by each job)
RUN python3.12 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install -U --no-cache-dir pip setuptools build

# main apptainer image (the CI runs the ecoli dataset: no Medaka, no LTR_retriever), with the file name
# expected by 'culebrONT install --sif-dir /opt/culebrONT/images'
RUN mkdir -p /opt/culebrONT/images && cd /opt/culebrONT/images \
    && wget -q --tries=10 -O apptainer.culebront_tools.${IMAGE_TAG}.sif ${IMAGES_URL}/apptainer.culebront_tools.sif
