FROM debian:bookworm-slim

ARG VERSION=4.7.2

RUN apt-get update && apt-get install -y --no-install-recommends \
        wget curl \
        gnupg \
        ca-certificates \
        python3 \
        python3-venv \
        python3-cryptography \
        libsecp256k1-dev \
        build-essential \
        pkg-config \
        autoconf \
        automake \
        libtool \
        procps \
    && rm -rf /var/lib/apt/lists/*

COPY install.sh /usr/local/bin/install-electrum.sh
RUN chmod +x /usr/local/bin/install-electrum.sh \
    && /usr/local/bin/install-electrum.sh "${VERSION}"

COPY requirements.txt /app/requirements.txt
RUN /opt/electrum/bin/pip install --quiet -r /app/requirements.txt

COPY bot.py /app/bot.py
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

WORKDIR /root

ENTRYPOINT ["/app/entrypoint.sh"]
