-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 963 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 963 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
28
29
30
FROM python:3.11-slim
WORKDIR /app
# Install dependencies first (cached layer unless requirements change)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create data directories for SQLite
# /data is the Railway persistent volume mount point — Railway mounts
# volumes as root, so we run as root (container is already sandboxed).
RUN mkdir -p /app/data /app/logs /app/reports /data
# Health check — hits the /api/health endpoint
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/api/health')" || exit 1
EXPOSE 8080
# Default to JSON logging in container
ENV LOG_FORMAT=json
ENV PORT=8080
# CRITICAL: Disable Python stdout/stderr buffering so logs appear in real-time
# Without this, Railway/Docker log collectors may miss log output entirely
ENV PYTHONUNBUFFERED=1
CMD ["python", "-u", "main.py"]