Spaces:
Runtime error
Runtime error
| FROM node:18-slim | |
| # Install dependencies needed for Playwright | |
| RUN apt-get update && \ | |
| apt-get install -y wget gnupg ca-certificates git \ | |
| libnss3 libcups2 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libasound2 fonts-freefont-ttf \ | |
| libglib2.0-0 libatk1.0-0 libatk-bridge2.0-0 libatspi2.0-0 libxfixes3 libxkbcommon0 libpango-1.0-0 libcairo2 && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN npx playwright install --with-deps | |
| # Switch to the node user | |
| USER node | |
| # Set environment variables for the user | |
| ENV HOME=/home/node \ | |
| PATH=/home/node/.local/bin:$PATH | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Copy the package.json and package-lock.json files to the working directory | |
| COPY --chown=node:node package*.json ./ | |
| # Install Node.js dependencies | |
| RUN npm install | |
| # Install Playwright without needing additional system dependencies | |
| RUN npx playwright install | |
| # Copy the application code to the working directory | |
| COPY --chown=node:node . . | |
| # Ensure the ownership of the directory to the node user | |
| RUN chown -R node:node . | |
| # Expose the port the app runs on | |
| EXPOSE 3000 | |
| # Command to run the Node.js server | |
| CMD ["node", "index.js"] | |