Spaces:
Sleeping
Sleeping
File size: 2,123 Bytes
ef80460 085912f ef80460 085912f dedec0d a7a64ac dedec0d a7a64ac 085912f ef80460 7c545fe ef80460 392073e 085912f 392073e 085912f |
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 77 |
# Use Ubuntu as base image
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
CODE_SERVER_VERSION=4.96.2 \
PASSWORD=huggingface
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
sudo \
vim \
nano \
build-essential \
python3 \
python3-pip \
nodejs \
npm \
unzip \
rsync \
&& rm -rf /var/lib/apt/lists/*
# Install Hugging Face CLI for dataset access
RUN pip3 install --no-cache-dir huggingface_hub[cli]
# Ensure huggingface-cli is in PATH for all users
ENV PATH="/usr/local/bin:${PATH}"
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
# Create a non-root user
RUN useradd -m -s /bin/bash coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Set working directory
WORKDIR /home/coder
# Create workspace directory
RUN mkdir -p /home/coder/workspace && \
chown -R coder:coder /home/coder
# Switch to non-root user
USER coder
# Expose port 7860 (Hugging Face Spaces default port)
EXPOSE 7860
# Create config directory
RUN mkdir -p /home/coder/.config/code-server
# Install AI coding assistant extensions that support Gemini
RUN code-server --install-extension Continue.continue || true
# Continue extension supports multiple AI models including Gemini
# Users can configure it with their Gemini API key after launch
# Set up code-server config
RUN echo "bind-addr: 0.0.0.0:7860" > /home/coder/.config/code-server/config.yaml && \
echo "auth: password" >> /home/coder/.config/code-server/config.yaml && \
echo "password: ${PASSWORD}" >> /home/coder/.config/code-server/config.yaml && \
echo "cert: false" >> /home/coder/.config/code-server/config.yaml
# Copy startup and backup scripts
COPY --chown=coder:coder startup.sh /home/coder/startup.sh
COPY --chown=coder:coder backup.sh /home/coder/backup.sh
RUN chmod +x /home/coder/startup.sh /home/coder/backup.sh
# Create symlink for easy access
RUN sudo ln -s /home/coder/backup.sh /usr/local/bin/backup
# Start code-server with persistence
CMD ["/home/coder/startup.sh"]
|