forked from heysagnik/screenREC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (40 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
53 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
# Build stage - uses pnpm workspace for building
FROM node:20-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@9.15.1 --activate
# Copy ALL workspace files needed for build
COPY pnpm-workspace.yaml ./
COPY package.json pnpm-lock.yaml* ./
COPY turbo.json ./
COPY apps/api ./apps/api
COPY packages/shared ./packages/shared
# Install ALL dependencies (including dev for build)
RUN pnpm install --frozen-lockfile
# Build the API
RUN pnpm build:api
# =============================================
# Production stage - COMPLETELY STANDALONE
# No pnpm, no workspace, just node and the built files
# =============================================
FROM node:20-alpine AS production
# Install FFmpeg for video conversion
RUN apk add --no-cache ffmpeg
WORKDIR /app
# Copy only the compiled JavaScript
COPY --from=builder /app/apps/api/dist ./dist
# Install ONLY runtime dependencies directly with npm
# This avoids all pnpm workspace issues
RUN npm init -y && \
npm install --save \
cors@^2.8.5 \
express@^4.21.2 \
express-rate-limit@^8.2.1 \
multer@^1.4.5-lts.1 \
sanitize-filename@^1.6.3
# Create temp directory for video processing
RUN mkdir -p /tmp/screenrec
# Expose API port
EXPOSE 3001
# Start the server
CMD ["node", "dist/index.js"]