Update Dockerfile
This commit is contained in:
parent
4b30c18310
commit
5510c07108
22
Dockerfile
22
Dockerfile
@ -1,18 +1,24 @@
|
|||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# System dependencies for Postgres & builds
|
# Install dependencies (including PostgreSQL client for pg_isready)
|
||||||
RUN apt-get update \
|
RUN apt-get update && apt-get install -y \
|
||||||
&& apt-get install -y gcc libpq-dev --no-install-recommends \
|
gcc \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
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 .
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy application code
|
# Copy the full application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Expose Flask port
|
# Default command (or override via docker-compose)
|
||||||
EXPOSE 3000
|
CMD ["sh", "-c", "until pg_isready -h db -p 5432; do echo '[web] waiting for db…'; sleep 1; done && python app.py"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user