-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (79 loc) · 2.6 KB
/
Dockerfile
File metadata and controls
101 lines (79 loc) · 2.6 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# ============================================
# Stage 1: Dependencies
# Install Node.js dependencies
# ============================================
FROM node:20-slim AS deps
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install dependencies (including devDependencies for build)
# Use npm install because lockfile contains override-resolved entries that
# can fail strict npm ci validation across npm minor/runtime differences.
RUN npm install --no-audit --no-fund
# ============================================
# Stage 2: Builder
# Build Next.js application
# ============================================
FROM node:20-slim AS builder
WORKDIR /app
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy source files
COPY package.json package-lock.json ./
COPY next.config.mjs tsconfig.json postcss.config.mjs eslint.config.mjs ./
COPY src ./src
COPY public ./public
# Set production environment for build
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Build Next.js application
RUN npm run build
# ============================================
# Stage 3: Runner
# Production image with Python + Next.js
# ============================================
FROM python:3.12-slim AS runner
WORKDIR /app
# Set environment variables
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PYTHONPATH=/app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV EXTRACTOR_PROFILE=full
# Install system dependencies
# - Node.js 20 for Next.js runtime
# - FFmpeg for video/audio processing
# - curl for health checks
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
gnupg \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy built Next.js application from builder stage
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
# Copy Python API
COPY api ./api
# Copy CHANGELOG.md for changelog page
COPY CHANGELOG.md ./
# Copy startup script
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# Expose Next.js and Python API ports
EXPOSE 3000 5000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:${PORT:-3000}/api/health || exit 1
# Start the application
CMD ["/app/start.sh"]