api / Dockerfile
ilhamdev's picture
Update Dockerfile
fe643d7 verified
raw
history blame
1.02 kB
# 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"]