forked from gommzystudio/device-activity-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (32 loc) · 1.04 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (32 loc) · 1.04 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
FROM node:20-alpine AS build
WORKDIR /app
# Install git and build dependencies
RUN apk add --no-cache git
# Copy package files
COPY package*.json ./
# Install dependencies (ignore postinstall script that tries to install client deps)
RUN npm install --ignore-scripts
# Copy source code and config
COPY tsconfig.json ./
COPY src ./src
# Build TypeScript
RUN npm run build
FROM node:20-alpine AS runtime
WORKDIR /app
# Install git and build dependencies
RUN apk add --no-cache git
# Copy package files
COPY package*.json ./
# Install dependencies (ignore postinstall script that tries to install client deps and dev dependencies)
RUN npm install --omit=dev --ignore-scripts
# Copy built server code
COPY --from=build /app/dist ./dist
# Persist Baileys multi-file auth state
ARG BAILEYS_AUTH_DIR=baileys_auth_info
ENV BAILEYS_AUTH_DIR=${BAILEYS_AUTH_DIR}
RUN mkdir -p "/app/${BAILEYS_AUTH_DIR}"
# Expose port (can be overridden by environment variable)
ARG EXPOSE_PORT=3001
ENV PORT=${EXPOSE_PORT}
EXPOSE ${EXPOSE_PORT}
CMD ["node", "dist/server.js"]