# FROM node:23.7.0 as builder # # Install git # RUN apt-get update && apt-get install -y git # # Clone the GitHub repository (if not already cloned) # RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app # # Set the working directory # WORKDIR /usr/src/app # # Change ownership of the directory to the current user (node) # RUN chown -R node:node /usr/src/app # # Mark the repository directory as safe # USER node # RUN git config --global --add safe.directory /usr/src/app # # Install npm dependencies # RUN npm install # # Expose the port your application runs on # EXPOSE 5000 # # Ensure that the latest code is pulled before starting the app # CMD git pull origin main && npm install && npm start FROM node:23.7.0 as builder # Install required dependencies (git & bash) RUN apt-get update && apt-get install -y git bash # Clone the GitHub repository (if not already cloned) RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app # Set the working directory WORKDIR /usr/src/app # Change ownership of the directory to the current user (node) RUN chown -R node:node /usr/src/app # Mark the repository directory as safe USER node RUN git config --global --add safe.directory /usr/src/app # Install npm dependencies RUN npm install # Copy start_docker.sh script into the container COPY start_docker.sh /usr/src/app/start_docker.sh # Give execution permission RUN chmod +x /usr/src/app/start_docker.sh # Expose the port your application runs on EXPOSE 5000 # Run the start_docker.sh script CMD ["/bin/bash", "/usr/src/app/start_docker.sh"]