Spaces:
Building
Building
Update Dockerfile
Browse files- Dockerfile +14 -9
Dockerfile
CHANGED
@@ -17,23 +17,26 @@ RUN apt-get update && \
|
|
17 |
g++ \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# --- PNPM Activation ---
|
21 |
# Enable corepack (built into Node >=16.13) to manage pnpm
|
22 |
-
# This makes the 'pnpm' command available without global install
|
23 |
RUN corepack enable
|
24 |
|
25 |
# Verify pnpm is active and check its version (optional, for confirmation)
|
26 |
RUN pnpm --version
|
27 |
# --- End PNPM Activation ---
|
28 |
|
29 |
-
# Set the working directory inside the container
|
30 |
-
WORKDIR /app
|
31 |
-
|
32 |
# --- Stage 2: Install Dependencies ---
|
33 |
-
|
34 |
-
# Copy package.json and pnpm lock file first to leverage Docker cache
|
35 |
-
COPY package.json pnpm-lock.yaml* ./
|
36 |
-
|
37 |
# Install dependencies using pnpm. Requires pnpm to be active (done above).
|
38 |
RUN pnpm install --frozen-lockfile
|
39 |
|
@@ -42,10 +45,12 @@ RUN pnpm install --frozen-lockfile
|
|
42 |
# Copy the rest of your application code
|
43 |
COPY . .
|
44 |
|
45 |
-
#
|
|
|
46 |
# WARNING: chmod 777 is a potential security risk. Grants full access to everyone.
|
47 |
RUN mkdir -p ./session ./downloads ./auth_info_baileys && \
|
48 |
chmod -R 777 ./session ./downloads ./auth_info_baileys
|
|
|
49 |
|
50 |
# Switch to the non-root 'node' user (still recommended for running the process)
|
51 |
USER node
|
|
|
17 |
g++ \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
+
# Set the working directory inside the container
|
21 |
+
WORKDIR /app
|
22 |
+
|
23 |
+
# --- Copy and Chown Before Corepack ---
|
24 |
+
# Copy package.json and pnpm lock file first
|
25 |
+
COPY package.json pnpm-lock.yaml* ./
|
26 |
+
|
27 |
+
# Change ownership of the /app directory to the 'node' user
|
28 |
+
# This ensures that copied files get the correct ownership.
|
29 |
+
RUN chown -R node:node /app
|
30 |
+
|
31 |
# --- PNPM Activation ---
|
32 |
# Enable corepack (built into Node >=16.13) to manage pnpm
|
|
|
33 |
RUN corepack enable
|
34 |
|
35 |
# Verify pnpm is active and check its version (optional, for confirmation)
|
36 |
RUN pnpm --version
|
37 |
# --- End PNPM Activation ---
|
38 |
|
|
|
|
|
|
|
39 |
# --- Stage 2: Install Dependencies ---
|
|
|
|
|
|
|
|
|
40 |
# Install dependencies using pnpm. Requires pnpm to be active (done above).
|
41 |
RUN pnpm install --frozen-lockfile
|
42 |
|
|
|
45 |
# Copy the rest of your application code
|
46 |
COPY . .
|
47 |
|
48 |
+
# --- MODIFIED SECTION ---
|
49 |
+
# Create the directories (dist removed) and set permissions to 777 (Use with caution!)
|
50 |
# WARNING: chmod 777 is a potential security risk. Grants full access to everyone.
|
51 |
RUN mkdir -p ./session ./downloads ./auth_info_baileys && \
|
52 |
chmod -R 777 ./session ./downloads ./auth_info_baileys
|
53 |
+
# --- END OF MODIFIED SECTION ---
|
54 |
|
55 |
# Switch to the non-root 'node' user (still recommended for running the process)
|
56 |
USER node
|