mirror of
https://github.com/thecyberlearn/quantumtaskai-caprover.git
synced 2026-08-18 07:32:55 +00:00
- Remove obsolete version from docker-compose.yml - Remove collectstatic from Dockerfile build process (will run after deployment) - Static files will be collected during post-deployment setup
45 lines
1.1 KiB
Docker
45 lines
1.1 KiB
Docker
# Use Python 3.11 slim image for better performance and smaller size
|
|
FROM python:3.11-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
postgresql-client \
|
|
gcc \
|
|
python3-dev \
|
|
libpq-dev \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project files
|
|
COPY . .
|
|
|
|
# Create logs directory
|
|
RUN mkdir -p logs
|
|
|
|
# Create non-root user for security
|
|
RUN adduser --disabled-password --gecos '' appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health/ || exit 1
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run gunicorn
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "netcop_hub.wsgi:application"]
|