# syntax=docker/dockerfile:1
# DexVerse downloader — bundles Python + dexverse + s5cmd (doc §19).
# Supports all three backends: s5cmd (default), python (boto3), http (presigned URLs).
#
#   docker build -t dexverse/dexverse-dl:0.1.0 .
#   docker run --rm -v /data:/out dexverse/dexverse-dl:0.1.0 \
#       download --manifest /manifest.json --out /out --backend http
#
# Or with a task id (manifest fetched from the backend inside the container):
#   docker run --rm -v /data:/out -e DEXVERSE_TOKEN=xxx \
#       dexverse/dexverse-dl:0.1.0 download --task dl_xxx --out /out \
#       --server https://dexverse.example.com --backend http

FROM python:3.11-slim AS base

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

# s5cmd (for the high-throughput s5cmd backend; harmless if you only use http/python)
ARG S5CMD_VERSION=v2.3.0
ADD https://github.com/peak/s5cmd/releases/download/${S5CMD_VERSION}/s5cmd_${S5CMD_VERSION}_Linux-64bit.tar.gz /tmp/s5cmd.tar.gz
RUN tar -xzf /tmp/s5cmd.tar.gz -C /usr/local/bin s5cmd && rm /tmp/s5cmd.tar.gz

# the package (built wheel sits in dist/)
COPY dist/dexverse-0.1.1-py3-none-any.whl /tmp/
RUN pip install --no-cache-dir "/tmp/dexverse-0.1.1-py3-none-any.whl[s3]"

WORKDIR /work
ENTRYPOINT ["dexverse-dl"]
CMD ["--help"]
