From 5510c07108b10acf3534aa88181580218cad783b Mon Sep 17 00:00:00 2001 From: saulteafarmer Date: Wed, 14 May 2025 16:53:47 +0000 Subject: [PATCH] Update Dockerfile --- Dockerfile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb9b2e9..c4e86f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,24 @@ FROM python:3.10-slim +# Set working directory WORKDIR /app -# System dependencies for Postgres & builds -RUN apt-get update \ - && apt-get install -y gcc libpq-dev --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* +# Install dependencies (including PostgreSQL client for pg_isready) +RUN apt-get update && apt-get install -y \ + gcc \ + libpq-dev \ + postgresql-client \ + --no-install-recommends && \ + rm -rf /var/lib/apt/lists/* -# Python dependencies +# Copy requirements first to leverage Docker caching COPY requirements.txt . + +# Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt -# Copy application code +# Copy the full application code COPY . . -# Expose Flask port -EXPOSE 3000 +# Default command (or override via docker-compose) +CMD ["sh", "-c", "until pg_isready -h db -p 5432; do echo '[web] waiting for db…'; sleep 1; done && python app.py"]