ilhamdev commited on
Commit
92da0f1
·
verified ·
1 Parent(s): 16db206

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,10 +1,10 @@
1
- # Use a specific version of Node for stability
2
  FROM node:18-alpine
3
 
4
- # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install git, Python 3, Chromium, FFmpeg, and other dependencies
8
  RUN apk add --no-cache \
9
  git \
10
  python3 \
@@ -15,28 +15,29 @@ RUN apk add --no-cache \
15
  harfbuzz \
16
  ca-certificates \
17
  ttf-freefont \
18
- ffmpeg
 
19
 
20
- # Copy package.json and package-lock.json first to leverage Docker caching
21
  COPY package*.json ./
22
 
23
- # Install production dependencies
24
  RUN npm install --only=production --unsafe-perm=true --allow-root
25
 
26
- # Install PM2 globally
27
  RUN npm install -g pm2
28
 
29
- # Add environment variables for Puppeteer
30
  ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
31
  PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
32
  PM2_PUBLIC_KEY=pheqiah2qgpu45w \
33
  PM2_SECRET_KEY=xk8zhybf7ns8ybz
34
 
35
- # Copy other files and directories to the working directory
36
  COPY . .
37
 
38
- # Expose port 7860
39
  EXPOSE 7860
40
 
41
- # Run the application using PM2
42
  CMD ["pm2-runtime", "index.js", "--name", "API"]
 
1
+ # Gunakan versi Node yang spesifik untuk stabilitas
2
  FROM node:18-alpine
3
 
4
+ # Setel direktori kerja di dalam kontainer
5
  WORKDIR /app
6
 
7
+ # Instal git, Python 3, Chromium, FFmpeg, dan dependensi lainnya
8
  RUN apk add --no-cache \
9
  git \
10
  python3 \
 
15
  harfbuzz \
16
  ca-certificates \
17
  ttf-freefont \
18
+ ffmpeg \
19
+ && ln -s /usr/bin/python3 /usr/bin/python
20
 
21
+ # Salin package.json dan package-lock.json terlebih dahulu untuk memanfaatkan caching Docker
22
  COPY package*.json ./
23
 
24
+ # Instal dependensi produksi
25
  RUN npm install --only=production --unsafe-perm=true --allow-root
26
 
27
+ # Instal PM2 secara global
28
  RUN npm install -g pm2
29
 
30
+ # Tambahkan variabel lingkungan untuk Puppeteer
31
  ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
32
  PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
33
  PM2_PUBLIC_KEY=pheqiah2qgpu45w \
34
  PM2_SECRET_KEY=xk8zhybf7ns8ybz
35
 
36
+ # Salin file dan direktori lain ke direktori kerja
37
  COPY . .
38
 
39
+ # Buka port 7860
40
  EXPOSE 7860
41
 
42
+ # Jalankan aplikasi menggunakan PM2
43
  CMD ["pm2-runtime", "index.js", "--name", "API"]