FROM node:23 # Create the app directory with correct permissions RUN mkdir -p /home/app && chown -R node:node /home/app # Install necessary libraries RUN apt-get update && \ apt-get install -y \ ffmpeg \ imagemagick \ webp \ wget \ gnupg \ libnss3 \ libxss1 \ libasound2 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libx11-xcb1 \ libxcomposite1 \ libxrandr2 \ libgbm1 \ libxshmfence1 \ libxi6 \ fonts-liberation \ libappindicator3-1 \ --no-install-recommends && \ apt-get upgrade -y && \ rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /home/app # Copy the entire app directory into the container with the correct ownership COPY --chown=node:node . . # Install dependencies RUN npm install || yarn install # Create the start.sh script with the correct permissions RUN echo '#!/bin/sh\nnpm start' > start.sh && \ chmod +x start.sh && \ chown node:node start.sh # Switch to the 'node' user USER node # Expose the port EXPOSE 7860 # Run the start.sh script CMD ["sh", "start.sh"]