# syntax=docker/dockerfile:1.7
# Tool image for Woodpecker steps that need nushell + hcloud CLI.
# Used by the golden-image-rebuild pipeline (TASK 10).
# Build this image once during bootstrap and push to reg.librecloud.online/images/nushell-hcloud:latest

FROM debian:bookworm-slim

ARG NUSHELL_VERSION=0.112.2
ARG HCLOUD_VERSION=1.47.0

RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates curl git openssh-client \
    && rm -rf /var/lib/apt/lists/*

RUN curl -fsSL \
    "https://github.com/nushell/nushell/releases/download/${NUSHELL_VERSION}/nu-${NUSHELL_VERSION}-aarch64-unknown-linux-gnu.tar.gz" \
    | tar -xz --strip-components=1 -C /usr/local/bin \
      "nu-${NUSHELL_VERSION}-aarch64-unknown-linux-gnu/nu"

RUN curl -fsSL \
    "https://github.com/hetznercloud/cli/releases/download/v${HCLOUD_VERSION}/hcloud-linux-arm64.tar.gz" \
    | tar -xz -C /usr/local/bin hcloud

RUN nu --version && hcloud version

ENTRYPOINT ["/usr/local/bin/nu"]
