# ============================================================
# match_12 – Hyperliquid Bot 専用 Docker イメージ
# Laravel アプリとは独立した軽量 Python コンテナ。
# ./python/hyperliquid と ./storage を Laravel と共有マウントして
# 設定ファイル・ステータス・ログを連携する。
# ============================================================
FROM python:3.11-slim-bookworm

ARG TZ=Asia/Tokyo

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    TZ=${TZ}

RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        tzdata \
        dumb-init \
    && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
    && rm -rf /var/lib/apt/lists/*

# Python 依存（hyperliquid-python-sdk, eth-account, anthropic）
COPY python/hyperliquid/requirements_hl.txt /tmp/requirements_hl.txt
RUN pip install --no-cache-dir -r /tmp/requirements_hl.txt \
    && rm /tmp/requirements_hl.txt

# エントリーポイント
COPY docker/hyperliquid/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

# Laravel プロジェクトルート相当（bot スクリプトが ROOT/storage/app を参照するため）
WORKDIR /app

# Python スクリプトと storage/app はホストからバインドマウントされる想定
# （docker-compose.yml を参照）

ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/entrypoint.sh"]
