Spaces:
Running
Running
File size: 2,260 Bytes
7311ade 8fa839f 7311ade a671b65 d3f40ae c57e208 7311ade 75f1ae1 7311ade c57e208 cd0659b ed010cf cd0659b d3f40ae 7311ade d3f40ae 2cb3286 d3f40ae 7311ade d3f40ae 7311ade d3f40ae c57e208 7311ade 2cb3286 a671b65 ed010cf 7311ade d3f40ae 7311ade | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # Use a lightweight Debian base for a simplified Linux environment
FROM debian:bookworm-slim
# Set environment variables to avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/home/user
ENV PATH=$HOME/.local/bin:$PATH
# Install essential system packages and build tools
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
sudo \
vim \
nano \
unzip \
procps \
net-tools \
netcat-openbsd \
build-essential \
cmake \
pkg-config \
python3 \
nginx \
xz-utils \
bzip2 \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install ttyd (Web Terminal)
RUN wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 -O /usr/bin/ttyd \
&& chmod +x /usr/bin/ttyd
# Install oauth2-proxy
# Download v7.6.0 release
RUN wget https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v7.6.0/oauth2-proxy-v7.6.0.linux-amd64.tar.gz \
&& tar -xzf oauth2-proxy-v7.6.0.linux-amd64.tar.gz \
&& mv oauth2-proxy-v7.6.0.linux-amd64/oauth2-proxy /usr/bin/oauth2-proxy \
&& chmod +x /usr/bin/oauth2-proxy \
&& rm -rf oauth2-proxy-v7.6.0.linux-amd64*
# Install Node.js (for manual OpenClaw installation later)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs
# Create a non-root user 'user' (UID 1000)
RUN useradd -m -u 1000 user && \
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Set up Nginx directories and permissions
RUN mkdir -p /var/www/html/game && \
mkdir -p /var/www/html/theme && \
chown -R user:user /var/www/html && \
chown -R user:user /var/log/nginx && \
chown -R user:user /var/lib/nginx && \
chown -R user:user /etc/nginx
# Switch to non-root user
WORKDIR $HOME
USER user
# Copy configuration files
COPY --chown=user:user nginx.conf /etc/nginx/nginx.conf
COPY --chown=user:user oauth2-proxy.cfg .
COPY --chown=user:user start.sh .
COPY --chown=user:user sign_in.html /var/www/html/theme/sign_in.html
RUN chmod +x start.sh
# Expose port 7860 (Standard for Hugging Face Spaces)
EXPOSE 7860
# Start services
CMD ["./start.sh"]
|