lead-hunter-ai / Dockerfile
agenticworkflowsspace's picture
Upload Dockerfile with huggingface_hub
b6e5012 verified
# --- Stage 1: Build the Frontend ---
FROM node:20-slim AS build-stage
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# --- Stage 2: Production Environment ---
# Use the official Playwright image which includes all system dependencies
FROM mcr.microsoft.com/playwright/python:v1.42.0-jammy
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PORT 7860
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-install Chromium in the image to prevent timeouts at runtime
RUN playwright install chromium
# Copy the built frontend from Stage 1
COPY --from=build-stage /app/frontend/dist ./frontend/dist
# Copy the backend code and tools
COPY app.py .
COPY tools/ ./tools/
# Create a temporary directory for results
RUN mkdir -p .tmp && chmod 777 .tmp
# Expose the port (Hugging Face Spaces uses 7860)
EXPOSE 7860
# Run the backend (which also serves the frontend)
CMD ["python", "app.py"]