Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +40 -7
Dockerfile
CHANGED
|
@@ -1,31 +1,64 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# ---- system deps ----
|
| 4 |
-
RUN apt-get update && apt-get install -y \
|
| 5 |
curl wget git htop nano vim sudo \
|
| 6 |
build-essential net-tools procps \
|
|
|
|
|
|
|
| 7 |
&& curl -fsSL https://code-server.dev/install.sh | sh \
|
| 8 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
# ----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN pip install --no-cache-dir \
|
| 12 |
-
requests ipython huggingface_hub transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# ---- create user WITH PASSWORD + sudo ----
|
| 15 |
RUN useradd -m -u 1000 -s /bin/bash user \
|
| 16 |
&& echo "user:user123" | chpasswd \
|
| 17 |
&& usermod -aG sudo user \
|
| 18 |
-
&& echo "user ALL=(ALL) ALL" > /etc/sudoers.d/user \
|
| 19 |
&& chmod 0440 /etc/sudoers.d/user
|
| 20 |
|
| 21 |
-
# ----
|
| 22 |
USER user
|
| 23 |
ENV HOME=/home/user \
|
| 24 |
PATH=/home/user/.local/bin:$PATH
|
| 25 |
WORKDIR /home/user
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
-
CMD ["code-server",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# ---- system deps ----
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
curl wget git htop nano vim sudo \
|
| 6 |
build-essential net-tools procps \
|
| 7 |
+
ca-certificates gnupg lsb-release \
|
| 8 |
+
openssh-client jq tree unzip zip \
|
| 9 |
&& curl -fsSL https://code-server.dev/install.sh | sh \
|
| 10 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# ---- Node.js 20 LTS ----
|
| 13 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 14 |
+
&& apt-get install -y --no-install-recommends nodejs \
|
| 15 |
+
&& npm install -g yarn pnpm typescript ts-node nodemon \
|
| 16 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# ---- Python deps ----
|
| 19 |
RUN pip install --no-cache-dir \
|
| 20 |
+
requests ipython huggingface_hub transformers \
|
| 21 |
+
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
|
| 22 |
+
numpy pandas scipy scikit-learn matplotlib \
|
| 23 |
+
flask fastapi uvicorn jupyter \
|
| 24 |
+
black ruff pylint
|
| 25 |
|
| 26 |
# ---- create user WITH PASSWORD + sudo ----
|
| 27 |
RUN useradd -m -u 1000 -s /bin/bash user \
|
| 28 |
&& echo "user:user123" | chpasswd \
|
| 29 |
&& usermod -aG sudo user \
|
| 30 |
+
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user \
|
| 31 |
&& chmod 0440 /etc/sudoers.d/user
|
| 32 |
|
| 33 |
+
# ---- switch to user ----
|
| 34 |
USER user
|
| 35 |
ENV HOME=/home/user \
|
| 36 |
PATH=/home/user/.local/bin:$PATH
|
| 37 |
WORKDIR /home/user
|
| 38 |
|
| 39 |
+
# ---- workspace + code-server extensions ----
|
| 40 |
+
RUN mkdir -p /home/user/workspace /home/user/.local/share/code-server
|
| 41 |
+
|
| 42 |
+
# Install useful extensions (Codeium AI, Python, etc.)
|
| 43 |
+
RUN code-server --install-extension ms-python.python \
|
| 44 |
+
&& code-server --install-extension esbenp.prettier-vscode \
|
| 45 |
+
&& code-server --install-extension bradlc.vscode-tailwindcss \
|
| 46 |
+
&& code-server --install-extension formulahendry.auto-rename-tag
|
| 47 |
+
|
| 48 |
+
# ---- code-server settings ----
|
| 49 |
+
RUN mkdir -p /home/user/.local/share/code-server/User \
|
| 50 |
+
&& echo '{\n\
|
| 51 |
+
"workbench.colorTheme": "Default Dark Modern",\n\
|
| 52 |
+
"editor.fontSize": 14,\n\
|
| 53 |
+
"editor.formatOnSave": true,\n\
|
| 54 |
+
"terminal.integrated.defaultProfile.linux": "bash",\n\
|
| 55 |
+
"extensions.autoUpdate": true\n\
|
| 56 |
+
}' > /home/user/.local/share/code-server/User/settings.json
|
| 57 |
|
| 58 |
EXPOSE 7860
|
| 59 |
|
| 60 |
+
CMD ["code-server", \
|
| 61 |
+
"--bind-addr", "0.0.0.0:7860", \
|
| 62 |
+
"--auth", "none", \
|
| 63 |
+
"--disable-telemetry", \
|
| 64 |
+
"/home/user/workspace"]
|