-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (40 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
56 lines (40 loc) · 1.28 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
# syntax=docker/dockerfile:1
# Build deps (mediasoup is a native module)
FROM node:22-bookworm-slim AS deps
WORKDIR /app
# Puppeteer is not required to run the SFU server; skip Chromium download by default.
# If you actually need Puppeteer in-container, set PUPPETEER_SKIP_DOWNLOAD=0 at build time.
ARG PUPPETEER_SKIP_DOWNLOAD=1
ENV PUPPETEER_SKIP_DOWNLOAD=${PUPPETEER_SKIP_DOWNLOAD}
# Install toolchain for native deps (including pip for mediasoup)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-pip \
make \
g++ \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
# Pre-install mediasoup to avoid network issues during build
RUN npm ci --omit=dev || ( \
echo "npm ci failed, trying with network access..." && \
npm ci --omit=dev --fetch-timeout=60000 \
)
COPY . .
# Runtime image
FROM node:22-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
# Keep the runtime lean; Chromium isn't needed for the SFU itself.
ENV PUPPETEER_SKIP_DOWNLOAD=1
# Copy app + built node_modules
COPY --from=deps /app /app
# Security: run as the non-root node user
USER node
# Signaling (HTTP + Socket.IO)
EXPOSE 3001/tcp
# WebRTC media (WebRtcServer default)
EXPOSE 20000/udp
EXPOSE 20000/tcp
CMD ["npm", "start"]