2026-02-08 10:33:24 +07:00
|
|
|
# Lightweight API server — reads bot_status.json from mounted volume
|
|
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install only API dependencies
|
|
|
|
|
COPY web-dashboard/api/requirements.txt requirements.txt
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
2026-02-09 05:46:54 +07:00
|
|
|
# Copy the API code
|
2026-02-08 10:33:24 +07:00
|
|
|
COPY web-dashboard/api/main.py main.py
|
2026-02-09 05:46:54 +07:00
|
|
|
COPY web-dashboard/api/db.py db.py
|
2026-02-08 10:33:24 +07:00
|
|
|
|
|
|
|
|
# Create data directory (will be overridden by volume mount)
|
|
|
|
|
RUN mkdir -p data
|
|
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
|
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')" || exit 1
|
|
|
|
|
|
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|