# Container for gitlab CI.
# Not meant for any other use.

ARG UV_VERSION=0.7.21
# alpine is not an easy option because of VTK
ARG DEBIAN_VERSION=bookworm-slim

FROM docker.io/debian:$DEBIAN_VERSION AS base
# unfortunately pyezzi wheels require debian > trixie so we need to build it
RUN apt-get update \
  && apt-get install -y --no-install-recommends gcc libc6-dev python3 python3-dev \
  && rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
COPY pyproject.toml uv.lock .
RUN uv sync --frozen \
            --all-extras \
            --all-groups \
            --no-install-project \
            --link-mode hardlink

FROM docker.io/debian:$DEBIAN_VERSION
ENV UV_LINK_MODE=copy
RUN apt-get update \
  && apt-get install -y --no-install-recommends python3 git libgomp1 \
  && rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
COPY --from=base /root/.cache/uv /root/.cache/uv
WORKDIR /workspace
