Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +51 -0
Dockerfile
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dockerfile to create a password-free, pre-configured AI development
|
| 2 |
+
# environment using code-server on a Hugging Face Space.
|
| 3 |
+
|
| 4 |
+
# 1. Base Image: Start from a slim Python 3.9 image.
|
| 5 |
+
FROM python:3.9-slim
|
| 6 |
+
|
| 7 |
+
# 2. Set Working Directory: Define the default directory for commands.
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# 3. Install System Dependencies:
|
| 11 |
+
# - curl: For downloading files from the web.
|
| 12 |
+
# - unzip: For extracting compressed archive files.
|
| 13 |
+
# - git: For version control.
|
| 14 |
+
# - Clean up apt cache to keep the image size small.
|
| 15 |
+
RUN apt-get update && apt-get install -y \
|
| 16 |
+
curl \
|
| 17 |
+
unzip \
|
| 18 |
+
git \
|
| 19 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
+
|
| 21 |
+
# 4. Install code-server:
|
| 22 |
+
# - Fetches and runs the official installation script for code-server.
|
| 23 |
+
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 24 |
+
|
| 25 |
+
# 5. Install Python AI/ML Libraries:
|
| 26 |
+
# - A curated list of popular libraries for AI model development.
|
| 27 |
+
RUN pip install --no-cache-dir \
|
| 28 |
+
transformers \
|
| 29 |
+
datasets \
|
| 30 |
+
torch \
|
| 31 |
+
torchvision \
|
| 32 |
+
torchaudio \
|
| 33 |
+
tensorflow \
|
| 34 |
+
scikit-learn \
|
| 35 |
+
pandas \
|
| 36 |
+
jupyter
|
| 37 |
+
|
| 38 |
+
# 6. Pre-install VS Code Extensions:
|
| 39 |
+
# - Installs the official Python and Jupyter extensions for a better IDE experience.
|
| 40 |
+
RUN code-server --install-extension ms-python.python && \
|
| 41 |
+
code-server --install-extension ms-toolsai.jupyter
|
| 42 |
+
|
| 43 |
+
# 7. Expose Port:
|
| 44 |
+
# - Makes port 8080 available for the code-server application.
|
| 45 |
+
EXPOSE 8080
|
| 46 |
+
|
| 47 |
+
# 8. Define Startup Command:
|
| 48 |
+
# - Starts code-server when the container launches.
|
| 49 |
+
# - --bind-addr 0.0.0.0:8080: Binds to all network interfaces on the specified port.
|
| 50 |
+
# - --auth none: Disables password authentication for easy access.
|
| 51 |
+
CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none"]
|