| FROM ubuntu:20.04 | |
| # Set non-interactive mode for installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Update system packages and install necessary tools | |
| RUN apt-get update -y && apt-get install -y \ | |
| curl \ | |
| wget \ | |
| tmate \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Node.js 18 from NodeSource | |
| RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Fix DNS issue by setting Google's DNS resolver | |
| RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf | |
| # Ensure the user is set to root (by default, Docker runs as root) | |
| USER root | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy package.json and install dependencies | |
| COPY package.json . | |
| RUN npm install | |
| # Copy the rest of the application files | |
| COPY . . | |
| # Expose necessary ports | |
| EXPOSE 3000 4000 5000 8080 888 80 443 22 | |
| # Run both Node.js server and tmate in parallel | |
| CMD ["bash", "-c", "node server.js & tmate -F"] |