landing/Dockerfile
Cipher Vance 6bf6d15fbe Refactor email sending for non-blocking performance and add request timing
• Dockerfile: bump Gunicorn workers to 4 for concurrent request handling
• server.py:

- Load SMTP credentials once at startup
- Wrap send_confirmation_email in a daemon Thread for “fire-and-forget” delivery
- Replace print() with structured app.logger.error() on failure
- Add before_request/after_request hooks to log per-request durations
- Use context manager for SMTP_SSL connections (auto-close)
- Simplify route JSON responses and HTTP methods declarations
- Retain existing DB logic but recommend low DB connect_timeouts
- Ensure Flask binds on 0.0.0.0 in development
These changes eliminate request blocking on email I/O, expose request latencies in logs, and improve overall concurrency.
2025-08-25 12:30:25 -05:00

17 lines
No EOL
315 B
Docker

FROM python:3.11-slim-buster
RUN apt-get update && apt-get install -y build-essential
WORKDIR /rideaware_landing
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV FLASK_APP=server.py
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "server:app"]