cmy / Dockerfile
Rajhuggingface4253's picture
Rename dockerfile to Dockerfile
9709060 verified
raw
history blame contribute delete
842 Bytes
# Use the Node.js base image.
FROM node:20-slim
# Install system dependencies.
# The --no-install-recommends flag prevents a lot of unnecessary packages from being installed, which can cause issues.
RUN apt-get update && apt-get install -y --no-install-recommends libheif-dev libavif-dev libheif-examples
# Set the working directory.
WORKDIR /app
# Copy the dependency files.
COPY package*.json ./
# Install Node.js dependencies.
RUN npm install
RUN npm install -g pm2
# Copy the rest of the application files.
COPY . .
# Expose the port your app runs on.
EXPOSE 7860
# Set thread pool size for optimal CPU utilization.
# This ensures Node.js async operations can use all available cores.
ENV UV_THREADPOOL_SIZE=16
# Command to run the application using PM2 to spin up 4 workers.
CMD [ "pm2-runtime", "start", "server.js", "-i", "4" ]