# Auto-generated by GitBlixt for Python apps FROM docker.io/python:3.12-slim WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends \ build-essential libpq-dev curl ca-certificates \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt* pyproject.toml* poetry.lock* ./ RUN if [ -f requirements.txt ]; then \ pip install --no-cache-dir -r requirements.txt; \ elif [ -f pyproject.toml ]; then \ pip install --no-cache-dir .; \ fi \ && pip install --no-cache-dir gunicorn COPY . . ENV PORT=4000 ENV PYTHONUNBUFFERED=1 EXPOSE ${PORT} # Auto-detects Django (manage.py), then falls back to wsgi.py / app.py / main.py. # ASGI (FastAPI, Starlette) users should replace this with a uvicorn invocation. CMD sh -c '\ if [ -f manage.py ]; then \ python manage.py migrate --noinput; \ WSGI_DIR=$(find . -maxdepth 3 -name wsgi.py -not -path "./.*" | head -1 | xargs dirname | sed "s|^\./||"); \ exec gunicorn --bind 0.0.0.0:$PORT "${WSGI_DIR}.wsgi:application"; \ elif [ -f wsgi.py ]; then exec gunicorn --bind 0.0.0.0:$PORT wsgi:application; \ elif [ -f app.py ]; then exec gunicorn --bind 0.0.0.0:$PORT app:app; \ elif [ -f main.py ]; then exec gunicorn --bind 0.0.0.0:$PORT main:app; \ else echo "No entry point found (manage.py, wsgi.py, app.py, or main.py)"; exit 1; \ fi'