Update Dockerfile

This commit is contained in:
saulteafarmer 2025-05-14 16:53:47 +00:00
parent 4b30c18310
commit 5510c07108

View File

@ -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"]