File size: 952 Bytes
df6a91e
0879cd7
76e79cc
df6a91e
76e79cc
 
df6a91e
d35f2b7
 
81e7316
 
 
 
 
 
df6a91e
0879cd7
df6a91e
9b02bc1
76e79cc
df6a91e
650e811
76e79cc
df6a91e
d35f2b7
780e721
df6a91e
81e7316
780e721
 
 
81e7316
df6a91e
76e79cc
 
df6a91e
76e79cc
 
df6a91e
 
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
# Use a specific version of Node for stability
FROM node:18-alpine

# Set the working directory inside the container
WORKDIR /app

# Install git, Chromium, and other dependencies for Puppeteer
RUN apk add --no-cache \
    git \
    chromium \
    nss \
    freetype \
    freetype-dev \
    harfbuzz \
    ca-certificates \
    ttf-freefont

# Copy package.json and package-lock.json first to leverage Docker caching
COPY package*.json ./

# Install production dependencies
RUN npm install --omit=dev

# Install PM2 globally
RUN npm install -g pm2

# Add environment variables for Puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
    PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
    PM2_PUBLIC_KEY=pheqiah2qgpu45w \
    PM2_SECRET_KEY=xk8zhybf7ns8ybz

# Copy other files and directories to the working directory
COPY . .

# Expose port 7860
EXPOSE 7860

# Run the application using PM2
CMD ["pm2", "runtime", "index.js", "--name", "API"]