WebTermux / Dockerfile
naimulislam864's picture
Create Dockerfile
56a5e7a verified
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_MAJOR=20
# Install base system utilities and tools
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
vim \
nano \
htop \
net-tools \
iputils-ping \
dnsutils \
unzip \
zip \
tar \
gzip \
bzip2 \
xz-utils \
build-essential \
python3 \
python3-pip \
sudo \
tmux \
screen \
ca-certificates \
gnupg \
lsb-release \
software-properties-common \
cgroup-tools \
procps \
coreutils \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json /app/package.json
RUN npm install
# Copy application files
COPY server.js /app/server.js
COPY public /app/public
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# Create a user for the terminal (but we'll run as root for HF Spaces compatibility)
RUN useradd -ms /bin/bash termuser && \
echo "termuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Set environment variables
ENV PORT=7860
ENV SHELL=/bin/bash
EXPOSE 7860
# Start script handles resource limiting and server startup
CMD ["/app/start.sh"]