| # Use an official Python runtime as the base image | |
| FROM python:3.9 | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file to the working directory | |
| COPY requirements.txt . | |
| # Install the Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install Node.js and npm | |
| RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
| apt-get install -y nodejs | |
| # Copy the package.json and package-lock.json files to the working directory | |
| COPY package*.json ./ | |
| # Install the Node.js dependencies | |
| RUN npm install | |
| # Copy the Flask application code to the working directory | |
| COPY . . | |
| # Copy the public directory (if exists) | |
| COPY public /app/public | |
| # Build the React application | |
| RUN npm run build | |
| RUN npm install reactflow | |
| # Verify Node.js and npm installation | |
| RUN node --version && npm --version | |
| # Expose the port on which the Flask application will run | |
| EXPOSE 7860 | |
| # Set the command to run the Flask application | |
| CMD ["python", "app.py"] |