FROM python:3.11-slim

WORKDIR /app

# The socket is only *mounted* at runtime, so nothing is needed at build time.
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app/ ./app

# Container discovery reads the socket mounted into the container.
ENV DOCKER_SOCKET=/var/run/docker.sock \
    PORT=8787 \
    HOST_BIND=0.0.0.0 \
    REFRESH_INTERVAL=3

EXPOSE 8787

CMD ["python", "main.py"]
