# Same pinned starter in a one-shot worker image, with no listening service.
# Build stage: compiler, git and the full checkout. Runtime stage: only the build.
FROM docker.io/library/elixir:1.20.2-otp-29-slim AS build
RUN apt-get update && apt-get install -y --no-install-recommends build-essential git ca-certificates
RUN mix local.hex --force && mix local.rebar --force
WORKDIR /starter
COPY setup.sh contributor.exs ./
RUN sh setup.sh

FROM docker.io/library/elixir:1.20.2-otp-29-slim
COPY --from=build /root/.mix /root/.mix
COPY --from=build /starter/contributor.exs /starter/contributor.exs
COPY --from=build /starter/raxol-agent/packages /starter/raxol-agent/packages
ENV MIX_ENV=dev
WORKDIR /starter/raxol-agent/packages/raxol_payments
CMD ["mix", "run", "--no-start", "--no-compile", "/starter/contributor.exs"]
