File size: 1,713 Bytes
008b10c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a3d6f25
b23d199
008b10c
 
 
 
 
 
 
 
 
 
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
# --- Stage 1: Base Setup ---

# Use Node.js 22 slim version as the base image
FROM node:22-slim AS base

# Set environment variables
ENV NODE_ENV=development \
    PNPM_HOME="/pnpm" \
    PATH="$PNPM_HOME:$PATH"

# Update package lists, install git and common build dependencies, and clean up
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      git \
      python3 \
      make \
      g++ \
    && rm -rf /var/lib/apt/lists/*

# --- PNPM Activation ---
# Enable corepack (built into Node >=16.13) to manage pnpm
# This makes the 'pnpm' command available without global install
RUN corepack enable

# Verify pnpm is active and check its version (optional, for confirmation)
RUN pnpm --version
# --- End PNPM Activation ---

# Set the working directory inside the container
WORKDIR /app

# --- Stage 2: Install Dependencies ---

# Copy package.json and pnpm lock file first to leverage Docker cache
COPY package.json pnpm-lock.yaml* ./

# Install dependencies using pnpm. Requires pnpm to be active (done above).
RUN pnpm install --frozen-lockfile

# --- Stage 3: Build & Runtime Setup ---

# Copy the rest of your application code
COPY . .

# Create the directories as requested and set permissions to 777 (Use with caution!)
# WARNING: chmod 777 is a potential security risk. Grants full access to everyone.
RUN mkdir -p ./session ./downloads ./auth_info_baileys && \
    chmod -R 777 ./session ./downloads ./auth_info_baileys

# Switch to the non-root 'node' user (still recommended for running the process)
USER node

# Expose the port your application will run on (as requested)
EXPOSE 7860

# The command to run your application using pnpm in dev mode
CMD ["pnpm", "run", "dev"]