sshx-space / Dockerfile
dakunesu's picture
Upload Dockerfile with huggingface_hub
91acc0d verified
# Use Ubuntu as base image for better compatibility
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PORT=7860
# Install required dependencies and download sshx as root
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
tar \
python3 \
sudo \
nano \
vim \
git \
wget \
htop \
net-tools \
iputils-ping \
build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL https://s3.amazonaws.com/sshx/sshx-x86_64-unknown-linux-musl.tar.gz -o /tmp/sshx.tar.gz \
&& tar -xzf /tmp/sshx.tar.gz -C /tmp \
&& mv /tmp/sshx /usr/local/bin/sshx \
&& chmod +x /usr/local/bin/sshx \
&& rm -f /tmp/sshx.tar.gz
# Create a non-root user and add to sudoers
RUN useradd -m -u 1000 user \
&& echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Switch to user
USER user
WORKDIR /home/user
# Copy web interface
COPY --chown=user:user index.html /home/user/index.html
# Expose port for Hugging Face Space
EXPOSE 7860
# Create startup script
COPY --chown=user:user start.sh /home/user/start.sh
RUN chmod +x /home/user/start.sh
# Run sshx
CMD ["/home/user/start.sh"]