File size: 1,017 Bytes
df6a91e
0879cd7
76e79cc
df6a91e
76e79cc
 
fe643d7
d35f2b7
 
fe643d7
81e7316
 
 
 
 
 
2fa1867
 
0879cd7
df6a91e
9b02bc1
76e79cc
df6a91e
fe643d7
76e79cc
df6a91e
d35f2b7
780e721
df6a91e
81e7316
780e721
 
 
81e7316
df6a91e
76e79cc
 
df6a91e
76e79cc
 
df6a91e
4ceb020
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
# Use a specific version of Node for stability
FROM node:18-alpine

# Set the working directory inside the container
WORKDIR /app

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

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

# Install production dependencies
RUN npm install --only=production --unsafe-perm=true --allow-root

# 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"]