# Public drydock-cli Docker image
# Published to Docker Hub as: fbobe3/drydock:<version> and :latest
#
# Run:
#   docker run -it --rm \
#       -e LLAMACPP_URL=http://host.docker.internal:8001/v1 \
#       -e LLAMACPP_MODEL=gemma4 \
#       --add-host=host.docker.internal:host-gateway \
#       -v "$HOME/.drydock:/root/.drydock" \
#       -v "$(pwd):/work" \
#       fbobe3/drydock:latest
#
# Image contains NO model weights. It expects an OpenAI-compatible LLM
# endpoint at $LLAMACPP_URL (default: host.docker.internal:8001/v1).
#
FROM ubuntu:24.04

LABEL org.opencontainers.image.title="drydock"
LABEL org.opencontainers.image.description="Local CLI coding agent with structured guardrails, retrieval, and reflection. See https://github.com/fbobe321/drydock"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.source="https://github.com/fbobe321/drydock"
LABEL org.opencontainers.image.url="https://hub.docker.com/r/fbobe3/drydock"

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends \
        python3 python3-pip python3-venv \
        git ca-certificates curl tini \
    && rm -rf /var/lib/apt/lists/*

# Use a venv to avoid PEP-668 system-pip block on Ubuntu 24.04
RUN python3 -m venv /opt/drydock-venv
ENV PATH=/opt/drydock-venv/bin:$PATH

# Pin the version we publish; can be overridden at build time.
ARG DRYDOCK_VERSION=
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
    && if [ -n "$DRYDOCK_VERSION" ]; then \
            pip install --no-cache-dir "drydock-cli==${DRYDOCK_VERSION}" ; \
       else \
            pip install --no-cache-dir drydock-cli ; \
       fi

# Embed an entrypoint that writes a sensible default config if
# /root/.drydock/config.toml doesn't already exist (mounted volume
# overrides this). Sets up the model endpoint from env at first
# run so the container is usable out of the box.
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

WORKDIR /work

# Default env values — override at `docker run` time
ENV LLAMACPP_URL="http://host.docker.internal:8001/v1"
ENV LLAMACPP_MODEL="gemma4"

ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]
CMD ["drydock"]
