FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ libpq-dev \ curl \ netcat-traditional \ dos2unix \ && rm -rf /var/lib/apt/lists/* # Create a non-root user RUN useradd -m -u 1000 celery # Set working directory WORKDIR /app # Copy start.sh first and set permissions COPY start.sh . RUN dos2unix start.sh && \ chmod +x start.sh # Copy requirements first to leverage Docker cache COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create necessary directories and set permissions RUN mkdir -p /app/uploads /app/static/uploads && \ chown -R celery:celery /app # Switch to non-root user USER celery # Set entrypoint using shell form ENTRYPOINT ./start.sh