-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (46 loc) · 1.33 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (46 loc) · 1.33 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
# ── Build stage ──
FROM node:20-slim AS build
WORKDIR /app
# Install build dependencies
COPY package*.json ./
# Important: include dev dependencies so typescript is installed
RUN npm ci --include=dev
# Generate Prisma client
COPY prisma ./prisma
RUN npx prisma generate
# Build TypeScript
COPY tsconfig.json ./
COPY src ./src
RUN npm run build && npx tsc
# ── Production stage ──
FROM node:20-slim
# Install Chromium and OpenSSL for whatsapp-web.js and Prisma
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
chromium \
ca-certificates \
fonts-liberation \
libnss3 \
libatk-bridge2.0-0 \
libx11-xcb1 \
libxcomposite1 \
libxrandr2 \
libgbm1 \
libasound2 \
libpangocairo-1.0-0 \
libgtk-3-0 \
openssl \
&& rm -rf /var/lib/apt/lists/*
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV NODE_ENV=production
WORKDIR /app
# Copy production files
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./
COPY --from=build /app/prisma ./prisma
EXPOSE 3000
# Default: run the API server
# Override with: `node dist/workers/start.js` for the background worker service
CMD ["node", "dist/index.js"]