# syntax=docker/dockerfile:1

FROM python:3.12-slim AS build

WORKDIR /app

COPY pyproject.toml README.md LICENSE ./
COPY src ./src

# Build the wheel and install it (plus runtime deps) into a prefix; only the
# installed files are copied to the runtime stage.
RUN python -m pip install --no-cache-dir --prefix /install .

FROM python:3.12-slim AS runtime

# Run as an unprivileged user; HOME is writable so config/history/TLS cache work.
RUN useradd --create-home --uid 10001 qrtransfer

COPY --from=build /install /usr/local

ENV PYTHONUNBUFFERED=1

USER qrtransfer
WORKDIR /home/qrtransfer

ENTRYPOINT ["qrtransfer"]
CMD ["--help"]
