FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PORT=5000 WORKDIR /app # Keep image minimal; add build tools only if future deps require them RUN apt-get update -y && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install dependencies (better layer caching) COPY requirements.txt ./ RUN pip install --upgrade pip && pip install -r requirements.txt # Copy application code COPY app.py ./ COPY templates ./templates COPY static ./static # Environment variables from Coolify (if used) ENV DEMO=$DEMO EXPOSE 5000 # Production server (use shell form so $PORT expands in Coolify) CMD gunicorn -w ${WEB_CONCURRENCY:-3} -b 0.0.0.0:${PORT:-5000} app:app