# Dockerfile.api FROM python:3.13-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 RUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install all deps from unified requirements.txt COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy API code COPY solarDb/ ./solarDb/ COPY wsgi.py ./wsgi.py # Data dir for TinyDB RUN mkdir -p /data && chown -R 1000:1000 /data VOLUME ["/data"] ENV FLASK_ENV=production \ APP_PORT=5001 \ DB_PATH=/data/db.json EXPOSE 5001 HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD curl -fsS http://localhost:5001/healthz || exit 1 CMD ["gunicorn", "-k", "gthread", "-w", "2", "-b", "0.0.0.0:5001", "--graceful-timeout", "30", "wsgi:app"]