# trimline-runner (h20): read-only nightly runner for the client's own GitHub Actions or Azure Container Apps Job.
# Build context: the azure-finops repo root (needs scanner/ and runner/):
#   docker build -f runner/Dockerfile -t trimline-runner:h20 .
# Base: Microsoft's Azure CLI image (az + Python). No secrets are baked in; the identity comes from the job
# (GitHub OIDC via azure/login, or the Container Apps Job managed identity with `az login --identity`).
FROM mcr.microsoft.com/azure-cli:2.93.0
LABEL org.opencontainers.image.title="trimline-runner" \
      org.opencontainers.image.description="Trimline read-only nightly runner: scan, anomaly check, tag and budget report" \
      org.opencontainers.image.vendor="Foundational IT"
WORKDIR /opt/trimline
COPY scanner/finops_scanner ./finops_scanner
COPY scanner/pricing ./pricing
COPY runner/trimline_runner ./trimline_runner
COPY runner/entrypoint.sh ./entrypoint.sh
RUN rm -f finops_scanner/approvals.py \
 && find . -name '__pycache__' -prune -exec rm -rf {} + \
 && chmod 0555 entrypoint.sh
# Non-root numeric user; az keeps its token cache under HOME (/tmp), inside the container only.
ENV PYTHONPATH=/opt/trimline PYTHONDONTWRITEBYTECODE=1 AZURE_CORE_COLLECT_TELEMETRY=no HOME=/tmp
USER 10001
WORKDIR /work
ENTRYPOINT ["/opt/trimline/entrypoint.sh"]
CMD ["--help"]
