# Base image
FROM ubuntu:latest

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

# Install necessary packages and npm
RUN apt-get update && \
    apt-get install -y curl build-essential && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    npm install -g holesail && npm i pm2 -g \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the PM2 setup script
COPY pm2-setup.sh /usr/local/bin/pm2-setup.sh
RUN chmod +x /usr/local/bin/pm2-setup.sh

# Run the PM2 setup script
CMD ["/usr/local/bin/pm2-setup.sh"]