Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +21 -8
Dockerfile
CHANGED
|
@@ -1,23 +1,36 @@
|
|
| 1 |
# ========================================
|
| 2 |
-
# Persistent VS Code Space with Python
|
| 3 |
# ========================================
|
| 4 |
FROM codercom/code-server:latest
|
| 5 |
|
|
|
|
| 6 |
USER root
|
|
|
|
|
|
|
|
|
|
| 7 |
RUN apt-get update && \
|
| 8 |
-
apt-get install -y python3 python3-pip python3-venv git && \
|
| 9 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
ENV TRANSFORMERS_CACHE=$HF_HOME/transformers
|
| 14 |
ENV HF_DATASETS_CACHE=$HF_HOME/datasets
|
| 15 |
|
| 16 |
-
# This tells Spaces
|
| 17 |
-
|
| 18 |
-
ENV HF_PERSISTENT_STORAGE=/home/coder
|
| 19 |
|
|
|
|
| 20 |
ENV TZ=Asia/Kolkata
|
|
|
|
|
|
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
| 1 |
# ========================================
|
| 2 |
+
# Persistent VS Code Space with Python (Root)
|
| 3 |
# ========================================
|
| 4 |
FROM codercom/code-server:latest
|
| 5 |
|
| 6 |
+
# 1. Switch to root user immediately
|
| 7 |
USER root
|
| 8 |
+
|
| 9 |
+
# 2. Install Python, git, and other utilities
|
| 10 |
+
# Added 'curl' and 'wget' as they are often needed for development
|
| 11 |
RUN apt-get update && \
|
| 12 |
+
apt-get install -y python3 python3-pip python3-venv git curl wget build-essential && \
|
| 13 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# 3. Setup Workspace Environment
|
| 16 |
+
# Since we are root, our home is now /root, not /home/coder
|
| 17 |
+
WORKDIR /root
|
| 18 |
+
|
| 19 |
+
# 4. Configure Hugging Face persistent storage paths
|
| 20 |
+
# We point these to /root so they persist if /root is mounted
|
| 21 |
+
ENV HF_HOME=/root/hf_home
|
| 22 |
ENV TRANSFORMERS_CACHE=$HF_HOME/transformers
|
| 23 |
ENV HF_DATASETS_CACHE=$HF_HOME/datasets
|
| 24 |
|
| 25 |
+
# This tells Spaces (if using a custom script) where the target persistence is
|
| 26 |
+
ENV HF_PERSISTENT_STORAGE=/root
|
|
|
|
| 27 |
|
| 28 |
+
# Set Timezone
|
| 29 |
ENV TZ=Asia/Kolkata
|
| 30 |
+
|
| 31 |
+
# 5. Expose the port (Hugging Face Spaces defaults to 7860)
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
+
# 6. Start Code-Server
|
| 35 |
+
# We point user-data-dir and extensions-dir to /root/vscode to keep config tidy
|
| 36 |
+
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "password", "--disable-telemetry", "--user-data-dir", "/root/vscode/data", "--extensions-dir", "/root/vscode/extensions", "/root/project"]
|