# Copyright 2026 Umbra Tools (umbratools.com)
# SPDX-License-Identifier: Apache-2.0

# cadprox reuses the official Caddy image so that validation, config adaptation
# and password hashing are performed by the exact same binary that will serve
# the traffic. A different Caddy build could accept a config the live instance
# then rejects.
FROM caddy:2.11.4

# The caddy image ships no Python, and app.py is standard library only.
# The base is Alpine, so it is apk rather than apt.
RUN apk add --no-cache python3

WORKDIR /app
COPY app.py /app/app.py

ENV CADPROX_CADDYFILE=/caddy/Caddyfile \
    CADPROX_CADDY_ADMIN=http://127.0.0.1:2019 \
    CADPROX_DATA=/data \
    CADPROX_PORT=8090 \
    PYTHONUNBUFFERED=1

EXPOSE 8090
VOLUME ["/data"]

ENTRYPOINT ["python3", "-u", "/app/app.py"]
