feat(docker): harden and productionize image build

This commit is contained in:
Cipher Vance 2025-08-31 12:10:57 -05:00
parent 9d78f1fdb4
commit e36bdc4568

View file

@ -1,18 +1,30 @@
# Use an official Python runtime as a base
FROM python:3.11-slim-buster
# Install build dependencies (build-essential provides gcc and other tools)
RUN apt-get update && apt-get install -y build-essential
# Set working directory
WORKDIR /app
WORKDIR /rideaware_landing
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
ENV FLASK_APP=server.py
# Environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV ENVIRONMENT=production
EXPOSE 5001
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "app:app"]
# Use Gunicorn as production server
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "4", "--timeout", "120", "app:app"]