# Railway's CLI, pinned. Their own image is x86-only; the release binaries are
# static, so this just fetches the one for the platform being built.
FROM alpine:3.22

ARG VERSION=5.57.12
ARG TARGETARCH

RUN case "$TARGETARCH" in \
      arm64) triple=aarch64-unknown-linux-musl ;; \
      amd64) triple=x86_64-unknown-linux-musl ;; \
      *) echo "unsupported: $TARGETARCH" >&2; exit 1 ;; \
    esac \
 && wget -qO- "https://github.com/railwayapp/cli/releases/download/v$VERSION/railway-v$VERSION-$triple.tar.gz" \
    | tar -xz -C /usr/local/bin railway \
 && railway --version

ENTRYPOINT ["railway"]
