FROM python:3.12-slim # Install system dependencies required for python-ldap (needed by backend) RUN apt-get update && apt-get install -y \ build-essential \ libldap2-dev \ libsasl2-dev \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy requirements and install COPY backend/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Create non-root user RUN adduser --system --group appuser # Copy application files COPY backend ./backend # We define the data dir explicitly for Docker ENV DATA_DIR="/app/data" ENV LOGS_DIR="/app/logs" # Ensure the appuser can write to data and logs if we pre-create them, # although Docker volumes will handle ownership context. RUN mkdir -p /app/data /app/logs && chown -R appuser:appuser /app USER appuser EXPOSE 8000 # Start Uvicorn pointing to the backend module CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]