# Use an official Node.js runtime as the base image | |
FROM node:14 | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy package.json and package-lock.json to the working directory | |
COPY package*.json ./ | |
# Install the project dependencies | |
RUN npm install --production | |
# Copy the rest of the project files to the working directory | |
COPY . . | |
# Build the app for production | |
RUN npm run build | |
# Expose port 7860 (Hugging Face Spaces requirement) | |
EXPOSE 7860 | |
# Set environment variables for production mode | |
ENV NODE_ENV=production PORT=7860 | |
# Specify the command to run your application in production mode | |
CMD ["npm", "run", "start:prod"] | |