FROM python:3.13-slim-trixie AS build

# The interpreter path in the virtualenv must match the path in the distroless image.
RUN ln -s /usr/local/bin/python /usr/bin/python \
    && /usr/bin/python -m venv /venv \
    && /venv/bin/pip install --no-cache-dir "google-auth[requests,cryptography]>=2.39.0"

FROM gcr.io/distroless/python3-debian13

COPY --from=build /venv /venv
COPY imds_emulator.py imds_test.py /app/

ENTRYPOINT ["/venv/bin/python3", "/app/imds_emulator.py"]
