FROM gitea/act_runner:latest
USER root

# Node for actions/checkout
RUN apk add --no-cache nodejs npm

# Rust build dependencies
RUN apk add --no-cache \
    curl wget git \
    build-base \
    pkgconfig \
    openssl-dev \
    musl-dev \
    bash

# Install Rust using bash explicitly
RUN wget -qO- https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Common targets
RUN /root/.cargo/bin/rustup target add \
    thumbv6m-none-eabi \
    thumbv7em-none-eabihf \
    thumbv8m.main-none-eabihf \
    x86_64-unknown-linux-musl

# Rust components
RUN /root/.cargo/bin/rustup component add \
    clippy rustfmt rust-docs

# cargo-audit for security checks
RUN /root/.cargo/bin/cargo install cargo-audit
