Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -12
Dockerfile
CHANGED
|
@@ -3,10 +3,11 @@ FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
TZ=Asia/Shanghai \
|
| 5 |
LANG=C.UTF-8 \
|
| 6 |
-
LC_ALL=C.UTF-8
|
|
|
|
| 7 |
|
| 8 |
# ========================
|
| 9 |
-
# Base dependencies
|
| 10 |
# ========================
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
curl git git-lfs wget unzip zip \
|
|
@@ -16,15 +17,17 @@ RUN apt-get update && apt-get install -y \
|
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
# ========================
|
| 19 |
-
# OpenVSCode Server (
|
| 20 |
# ========================
|
| 21 |
ARG VSCODE_VERSION=1.99.0
|
| 22 |
|
| 23 |
RUN mkdir -p /app/openvscode-server && \
|
| 24 |
-
curl -L -o openvscode.tar.gz \
|
| 25 |
https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v${VSCODE_VERSION}/openvscode-server-v${VSCODE_VERSION}-linux-x64.tar.gz && \
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# ========================
|
| 30 |
# Node.js tools
|
|
@@ -34,9 +37,11 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
|
| 34 |
npm install -g configurable-http-proxy tsx tslab http-server miniflare@2
|
| 35 |
|
| 36 |
# ========================
|
| 37 |
-
# User setup (clean)
|
| 38 |
# ========================
|
| 39 |
-
RUN useradd -m user &&
|
|
|
|
|
|
|
| 40 |
|
| 41 |
ENV HOME=/home/user
|
| 42 |
ENV PATH=$HOME/miniconda/bin:$PATH
|
|
@@ -53,7 +58,7 @@ RUN curl -sLo ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py31
|
|
| 53 |
rm ~/miniconda.sh
|
| 54 |
|
| 55 |
# ========================
|
| 56 |
-
# Root
|
| 57 |
# ========================
|
| 58 |
USER root
|
| 59 |
|
|
@@ -64,7 +69,7 @@ COPY on_startup.sh /root/on_startup.sh
|
|
| 64 |
RUN bash /root/on_startup.sh
|
| 65 |
|
| 66 |
# ========================
|
| 67 |
-
# Python
|
| 68 |
# ========================
|
| 69 |
USER user
|
| 70 |
|
|
@@ -72,12 +77,12 @@ COPY requirements.txt /home/user/app/
|
|
| 72 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 73 |
|
| 74 |
# ========================
|
| 75 |
-
#
|
| 76 |
# ========================
|
| 77 |
COPY --chown=user . /home/user/app
|
| 78 |
|
| 79 |
# ========================
|
| 80 |
-
# Playwright (optional)
|
| 81 |
# ========================
|
| 82 |
RUN pip install playwright && playwright install --with-deps
|
| 83 |
|
|
|
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
TZ=Asia/Shanghai \
|
| 5 |
LANG=C.UTF-8 \
|
| 6 |
+
LC_ALL=C.UTF-8 \
|
| 7 |
+
PYTHONUNBUFFERED=1
|
| 8 |
|
| 9 |
# ========================
|
| 10 |
+
# Base dependencies (stable minimal set)
|
| 11 |
# ========================
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
curl git git-lfs wget unzip zip \
|
|
|
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
# ========================
|
| 20 |
+
# OpenVSCode Server (HARDENED)
|
| 21 |
# ========================
|
| 22 |
ARG VSCODE_VERSION=1.99.0
|
| 23 |
|
| 24 |
RUN mkdir -p /app/openvscode-server && \
|
| 25 |
+
curl -L -o /tmp/openvscode.tar.gz \
|
| 26 |
https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v${VSCODE_VERSION}/openvscode-server-v${VSCODE_VERSION}-linux-x64.tar.gz && \
|
| 27 |
+
file /tmp/openvscode.tar.gz && \
|
| 28 |
+
test "$(file /tmp/openvscode.tar.gz | grep -i gzip)" || (echo "❌ Invalid VSCode download" && exit 1) && \
|
| 29 |
+
tar -xzf /tmp/openvscode.tar.gz -C /app/openvscode-server --strip-components=1 && \
|
| 30 |
+
rm /tmp/openvscode.tar.gz
|
| 31 |
|
| 32 |
# ========================
|
| 33 |
# Node.js tools
|
|
|
|
| 37 |
npm install -g configurable-http-proxy tsx tslab http-server miniflare@2
|
| 38 |
|
| 39 |
# ========================
|
| 40 |
+
# User setup (clean & safe)
|
| 41 |
# ========================
|
| 42 |
+
RUN useradd -m user && \
|
| 43 |
+
mkdir -p /home/user/app && \
|
| 44 |
+
chown -R user:user /home/user
|
| 45 |
|
| 46 |
ENV HOME=/home/user
|
| 47 |
ENV PATH=$HOME/miniconda/bin:$PATH
|
|
|
|
| 58 |
rm ~/miniconda.sh
|
| 59 |
|
| 60 |
# ========================
|
| 61 |
+
# Root scripts
|
| 62 |
# ========================
|
| 63 |
USER root
|
| 64 |
|
|
|
|
| 69 |
RUN bash /root/on_startup.sh
|
| 70 |
|
| 71 |
# ========================
|
| 72 |
+
# Python deps
|
| 73 |
# ========================
|
| 74 |
USER user
|
| 75 |
|
|
|
|
| 77 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 78 |
|
| 79 |
# ========================
|
| 80 |
+
# App source (IMPORTANT FIXED ORDER)
|
| 81 |
# ========================
|
| 82 |
COPY --chown=user . /home/user/app
|
| 83 |
|
| 84 |
# ========================
|
| 85 |
+
# Playwright (optional but stable)
|
| 86 |
# ========================
|
| 87 |
RUN pip install playwright && playwright install --with-deps
|
| 88 |
|