FROM python:3.11-slim

LABEL org.opencontainers.image.title="ton-devtools-rpc-mock"
LABEL org.opencontainers.image.description="Deterministic Toncenter API v2 emulator"
LABEL org.opencontainers.image.source="https://github.com/ismaildalgatov/ton-devtools"
LABEL org.opencontainers.image.licenses="MIT"

WORKDIR /app

COPY pyproject.toml README.md ./
COPY ton_devtools_rpc_mock/ ./ton_devtools_rpc_mock/

RUN pip install --no-cache-dir ".[dev]"

ENV MOCK_CONTROL=1

EXPOSE 8080

HEALTHCHECK --interval=10s --timeout=3s --start-period=5s \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/jsonRPC', \
  data=b'{\"method\":\"getWalletInformation\",\"params\":{\"address\":\"0:\"}}', timeout=2)"

CMD ["ton-devtools-rpc-mock", "--host", "0.0.0.0", "--port", "8080", "--control"]
