Spaces:
Paused
Paused
| # Use Node.js 18 base image | |
| FROM node:20 | |
| # Create a non-root user | |
| RUN groupadd -r appuser && useradd -r -g appuser appuser | |
| # Set working directory | |
| WORKDIR /usr/src/app | |
| # Copy package files and install dependencies | |
| COPY package*.json ./ | |
| RUN npm install | |
| RUN npm install chrome-lens-ocr node-fetch sharp | |
| # If building for production, use: | |
| # RUN npm ci --only=production | |
| # Copy application source code | |
| COPY . . | |
| # Change ownership of the app directory to the non-root user | |
| RUN chown -R appuser:appuser /usr/src/app | |
| # Switch to the non-root user | |
| USER appuser | |
| # Expose the desired port (optional, based on your server.js configuration) | |
| EXPOSE 7860 | |
| # Set the default command to start the server | |
| CMD ["node", "server.js"] | |