FROM debian:trixie-slim

# Base packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    apt-transport-https \
    build-essential \
    ca-certificates \
    curl \
    git \
    buildah \
    skopeo \
    fuse-overlayfs \
    make \
    && \
    apt-get clean

# Node
COPY sources.list /etc/apt/sources.list.d/nodejs.list
COPY apt.preferences /etc/apt/preferences.d/nodejs
RUN curl -sSL -o /etc/apt/trusted.gpg.d/nodesource.gpg.asc "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key"

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    nodejs \
    && \
    apt-get clean

# Env
ENV PATH=/usr/local/go/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV BUILDAH_ISOLATION=chroot

# Go
ARG GOVERSION=1.25.7
RUN curl -s -L https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz \
    | tar xvz -C /usr/local

# Uv and reuse
COPY --from=ghcr.io/astral-sh/uv:latest /uv* /bin/
RUN uv tool install reuse

# Buildah storage configuration
COPY storage.conf /etc/containers/storage.conf
