# Use an official Node.js runtime as the base image FROM node:20 # Set the working directory in the container WORKDIR /app # Copy package.json and install all dependencies COPY package.json ./ RUN npm install # Copy the rest of the application code COPY . . # Build the React frontend into the 'dist' folder # This is the folder server.js will serve RUN npm run build # Create an empty SQLite database file and set permissions # This ensures the application has write access in the container RUN touch database.db && chmod 777 database.db # Hugging Face Spaces use port 7860 by default ENV PORT=7860 EXPOSE 7860 # Start the application using the start script defined in package.json CMD ["npm", "start"]