-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (18 loc) · 882 Bytes
/
Dockerfile
File metadata and controls
27 lines (18 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir fastapi uvicorn pydantic apscheduler httpx
# Install sqlite3 CLI for backup scripts
RUN apt-get update && apt-get install -y --no-install-recommends sqlite3 cron && rm -rf /var/lib/apt/lists/*
COPY src/ ./src/
COPY dash/ ./dash/
COPY scripts/backup.sh /app/scripts/backup.sh
RUN mkdir -p /data /data/backups
RUN chmod +x /app/scripts/backup.sh
ENV RESGOV_DB_PATH=/data/resgov.db
ENV RESGOV_BACKUP_DIR=/data/backups
ENV RESGOV_BACKUP_RETENTION=7
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" || exit 1
# Start cron + uvicorn
CMD ["sh", "-c", "echo '0 3 * * * /app/scripts/backup.sh >> /data/backup.log 2>&1' | crontab - && cron && python -m uvicorn src.api:app --host 0.0.0.0 --port 8080"]