CoolFace
Apppublic

pjpushparaj/ImageRecognitionAttendanceSystem

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
Dockerfile48 linesDownload Raw Back to root
1# --- Stage 1: Build the React Frontend ---2FROM node:20-alpine AS frontend-builder3WORKDIR /app/frontend4COPY frontend/package*.json ./5RUN npm ci6COPY frontend/ ./7RUN npm run build8 9# --- Stage 2: Build the FastAPI Backend ---10FROM python:3.10-slim11 12# Install system dependencies for OpenCV and DeepFace13RUN apt-get update && apt-get install -y --no-install-recommends \14    build-essential \15    libgl1 \16    libglib2.0-0 \17    libsm6 \18    libxext6 \19    libxrender-dev \20    && rm -rf /var/lib/apt/lists/*21 22WORKDIR /app23 24# Copy requirements and install dependencies25COPY backend/requirements.txt ./26RUN pip install --no-cache-dir -r requirements.txt27 28# Pre-download ArcFace and RetinaFace model weights for deepface to speed up first validation run29RUN python -c "from deepface import DeepFace; DeepFace.build_model('ArcFace')" || true30RUN python -c "from deepface import DeepFace; DeepFace.build_model('RetinaFace')" || true31 32# Copy backend application33COPY backend/ ./backend34 35# Copy built frontend assets to static folder served by backend36COPY --from=frontend-builder /app/frontend/dist ./frontend/dist37 38# Create directories and grant broad write permissions for Hugging Face non-root user (uid 1000)39RUN mkdir -p /app/uploads /app/temp_scans && chmod -R 777 /app40 41# Expose port and define default environment variables42EXPOSE 786043ENV PORT=786044 45# Start command46CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]47 48