quantumtaskai-caprover/Dockerfile.captain
thecyberlearn b0e8c917ef Initial clean CapRover deployment - no secrets
Complete Django AI agent marketplace with security optimizations
and clean deployment documentation without any API keys or secrets.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 10:50:55 +05:30

44 lines
1.3 KiB
Docker

FROM python:3.11-slim
WORKDIR /app
# Install system dependencies in one layer and clean up
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
postgresql-client \
&& pip install --upgrade pip \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Create non-root user early
RUN useradd --create-home --shell /bin/bash app
# Copy and install requirements (better caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
&& pip cache purge
# Copy application code
COPY --chown=app:app . .
# Set build environment variables
ENV SECRET_KEY="build-time-dummy-key-not-for-production" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/app
# Collect static files
RUN python manage.py collectstatic --noinput
# Switch to non-root user
USER app
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python manage.py check || exit 1
# Expose port
EXPOSE 80
# Optimized gunicorn configuration
CMD ["gunicorn", "--bind", "0.0.0.0:80", "--workers", "2", "--threads", "4", "--worker-class", "gthread", "--worker-tmp-dir", "/dev/shm", "--timeout", "120", "--keep-alive", "5", "--max-requests", "1000", "--max-requests-jitter", "100", "netcop_hub.wsgi:application"]