# Custom Gitea act_runner image for the ROLAC pipeline.
#
# The workflow needs BOTH the .NET SDK (dotnet test) and the Docker CLI
# (docker build / push / compose) in the same execution environment. The stock
# gitea/act_runner image has neither, so we bake them on top of the .NET 8 SDK
# image and copy the act_runner binary in. Registered as label `ubuntu:host`,
# every step runs inside THIS container, which talks to the host Docker daemon
# via the mounted socket.
FROM mcr.microsoft.com/dotnet/sdk:8.0

# Docker CLI + compose plugin, Node.js (JS-based actions like checkout need it),
# git, curl, bash.
RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl gnupg git bash \
 && install -m 0755 -d /etc/apt/keyrings \
 && curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
 && chmod a+r /etc/apt/keyrings/docker.asc \
 && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" \
      > /etc/apt/sources.list.d/docker.list \
 && apt-get update \
 && apt-get install -y --no-install-recommends docker-ce-cli docker-compose-plugin \
 && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
 && apt-get install -y --no-install-recommends nodejs \
 && rm -rf /var/lib/apt/lists/*

# act_runner binary from the official image.
COPY --from=gitea/act_runner:latest /usr/local/bin/act_runner /usr/local/bin/act_runner

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# .runner registration state persists here (mount a volume).
WORKDIR /data
ENTRYPOINT ["/entrypoint.sh"]
