# syntax=docker/dockerfile:1.6

FROM node:20-bookworm

LABEL org.opencontainers.image.source="https://codeberg.org/johba/harb-ci"
LABEL org.opencontainers.image.description="Node.js toolchain for Harb Stack CI jobs"

ENV DEBIAN_FRONTEND=noninteractive \
    PNPM_HOME=/root/.local/share/pnpm \
    PATH=/root/.local/share/pnpm:/root/.local/bin:/root/.foundry/bin:$PATH

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    apt-get update && \
    apt-get install -y --no-install-recommends \
      git \
      ca-certificates \
      build-essential \
      pkg-config \
      libssl-dev \
      python3 \
      python3-pip \
      bc \
      jq \
      curl && \
    rm -rf /var/lib/apt/lists/*

# Enable corepack-managed package managers and pin the versions we expect in CI.
RUN corepack enable && \
    corepack prepare pnpm@8.15.4 --activate && \
    corepack prepare yarn@1.22.19 --activate

# Install Foundry once so downstream jobs skip the bootstrap step.
RUN curl -L https://foundry.paradigm.xyz | bash && \
    ~/.foundry/bin/foundryup --version && \
    ~/.foundry/bin/foundryup

WORKDIR /workspace

CMD ["bash"]
