FROM python:3.14-slim
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 BUTLER_DATA=/data
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && useradd --uid 10001 --create-home butler && mkdir /data && chown butler:butler /data
COPY zaptec.py core.py recurring.py autocharge.py charging.py server.py localization.py translations.json healthcheck.py ./
COPY web ./web
USER butler
EXPOSE 8788
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=6 CMD ["python", "healthcheck.py"]
CMD ["python", "server.py", "--bind", "0.0.0.0"]
