## e2e-consumer image. Built from `tests/Azaion.Missions.E2E.Tests/`.
## Runs `dotnet test --logger trx`, then converts the .trx into the flat
## CSV documented in _docs/02_document/tests/environment.md § Reporting.

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY . .

RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
    dotnet publish Reporting.Cli/Reporting.Cli.csproj \
        -c Release -o /app/cli --os linux --arch $arch && \
    dotnet build Azaion.Missions.E2E.Tests.csproj -c Release

## Runtime stage uses the SDK image because `dotnet test` requires it.
FROM mcr.microsoft.com/dotnet/sdk:10.0
WORKDIR /src
COPY --from=build /src /src
COPY --from=build /app/cli /app/cli
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENV RESULTS_DIR=/app/results
ENTRYPOINT ["/entrypoint.sh"]
