add docker files

This commit is contained in:
2025-09-17 09:14:30 +03:00
parent c2613de507
commit 58e69ba69e
6 changed files with 153 additions and 0 deletions

32
solarDb/Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# 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"]