# Use Node.js 18 as base image | |
FROM node:18-alpine | |
# Set working directory | |
WORKDIR /app | |
# Copy package files | |
COPY package*.json ./ | |
# Install dependencies | |
RUN npm ci --only=production | |
# Copy source code | |
COPY . . | |
# Build the application | |
RUN npm run build | |
# Expose required port (Hugging Face requirement) | |
EXPOSE 7860 | |
# Set environment variables | |
ENV PORT=7860 | |
ENV HOSTNAME=0.0.0.0 | |
# Start command with correct port | |
CMD ["npm", "start"] |