From e36bdc45689f4b6f9acc4e1ec8280981dcd9cca4 Mon Sep 17 00:00:00 2001 From: Cipher Vance Date: Sun, 31 Aug 2025 12:10:57 -0500 Subject: [PATCH] feat(docker): harden and productionize image build --- Dockerfile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d0ac86..7d08d00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file