# claudia-proxy: egress allowlist for `claudia run --restricted`.
#
# The Claude container sits on an internal network with no route out; this
# proxy is attached to both that network and a normal one, and only forwards
# to the domains listed in CLAUDIA_ALLOW (space-separated).
FROM docker.io/library/debian:trixie-slim

ARG BUILD_DATE=unknown
ARG GIT_REVISION=unknown
LABEL org.opencontainers.image.title="claudia-proxy" \
      org.opencontainers.image.description="Egress allowlist proxy for claudia --restricted" \
      org.opencontainers.image.source="https://kode.naiv.no/olemd/claudia" \
      org.opencontainers.image.licenses="MIT" \
      org.opencontainers.image.created="${BUILD_DATE}" \
      org.opencontainers.image.revision="${GIT_REVISION}"

RUN apt-get update \
 && apt-get install -y --no-install-recommends tinyproxy \
 && rm -rf /var/lib/apt/lists/*

COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
COPY entrypoint.sh /usr/local/bin/claudia-proxy-entrypoint
RUN chmod 0644 /etc/tinyproxy/tinyproxy.conf \
 && chmod 0755 /usr/local/bin/claudia-proxy-entrypoint \
 && printf 'build_date=%s\ngit_revision=%s\n' "${BUILD_DATE}" "${GIT_REVISION}" > /etc/build-info

EXPOSE 8888
ENTRYPOINT ["/usr/local/bin/claudia-proxy-entrypoint"]
