-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (48 loc) · 1.67 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# ==========================================
# Stage 1: Build React 19 Frontend
# ==========================================
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# ==========================================
# Stage 2: Python 3.12 Backend & Runtime
# ==========================================
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies for multimodal intelligence (FFmpeg, Tesseract OCR)
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
tesseract-ocr \
tesseract-ocr-eng \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user with UID 1000 (standard requirement for Hugging Face Spaces)
RUN useradd -m -u 1000 user
WORKDIR /app
# Install Python requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend application and pipelines
COPY backend/ ./backend/
COPY pipelines/ ./pipelines/
COPY preview_pipeline/ ./preview_pipeline/
COPY final_post_pipeline/ ./final_post_pipeline/
COPY enhancements/ ./enhancements/
COPY server.py ./
# Copy compiled frontend from Stage 1
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Initialize persistent runtime storage folders and transfer ownership to user 1000
RUN mkdir -p storage/uploads storage/previews storage/links storage/renders && \
chown -R user:user /app
# Switch to user 1000
USER user
# Default port configuration (Hugging Face Spaces listens on port 7860)
ENV HOST=0.0.0.0
ENV PORT=7860
EXPOSE 7860
CMD ["python", "server.py"]