-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (44 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
59 lines (44 loc) · 1.32 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
# Build stage
FROM oven/bun:1-debian AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lock* ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Build the application (use next build directly for standalone output compatibility)
RUN bun next build
# Production stage
FROM debian:bookworm-slim AS runner
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
ffmpeg \
python3 \
python3-venv \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install yt-dlp in virtual environment
RUN python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir yt-dlp
ENV PATH="/opt/venv/bin:$PATH"
# Install Bun (latest stable)
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:$PATH"
# Set environment variables
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Copy built application from builder stage
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000 || exit 1
# Start the application
CMD ["bun", "run", "server.js"]