File size: 861 Bytes
06fe404 50e4c5f 06fe404 |
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 |
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Update and install dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
python3 \
python3-pip \
&& apt-get clean
# Install code-server properly
RUN curl -fsSL https://code-server.dev/install.sh | sh
# Work directory
WORKDIR /workspace
# Hugging Face will pass PASSWORD as an environment variable
# In HF Space → Settings → Variables → add:
# PASSWORD = yourpassword
# ENV PASSWORD=""
# Expose Hugging Face port
EXPOSE 7860
# Start VS Code server
# If PASSWORD isn't set, print error and exit (so you notice)
CMD bash -c ' \
if [ -z "$PASSWORD" ]; then \
echo "ERROR: PASSWORD env variable not set in Hugging Face Space settings."; \
exit 1; \
fi; \
code-server --bind-addr 0.0.0.0:7860 --auth password /workspace \
'
|