Spaces:
Paused
Paused
add user
Browse files- Dockerfile +17 -5
- start_with_sync.sh +9 -4
Dockerfile
CHANGED
|
@@ -15,10 +15,26 @@ RUN apt update && apt install -y \
|
|
| 15 |
# We will install Node.js and npm using nvm or a direct method, not apt's potentially older versions
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Install nvm (Node Version Manager) and then use it to install Node.js and npm
|
| 19 |
# This ensures a clean and controlled Node.js/npm environment
|
| 20 |
-
RUN mkdir -p /nvm
|
| 21 |
ENV NVM_DIR /nvm
|
|
|
|
| 22 |
ENV NODE_VERSION 20.17.0
|
| 23 |
# Specify a compatible Node.js version, matching the earlier error message's requirement
|
| 24 |
|
|
@@ -36,10 +52,6 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | b
|
|
| 36 |
# Verify Node.js and npm versions
|
| 37 |
RUN . "$NVM_DIR/nvm.sh" && node -v && npm -v
|
| 38 |
|
| 39 |
-
# Install Python packages
|
| 40 |
-
RUN pip install --no-cache-dir \
|
| 41 |
-
huggingface_hub \
|
| 42 |
-
datasets
|
| 43 |
|
| 44 |
# Set all cache directories to /tmp (writable)
|
| 45 |
ENV HF_HOME=/tmp/hf_cache
|
|
|
|
| 15 |
# We will install Node.js and npm using nvm or a direct method, not apt's potentially older versions
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
+
# Create a new group (optional, but good practice)
|
| 19 |
+
RUN groupadd --system appuser
|
| 20 |
+
|
| 21 |
+
# Create a new user and add them to the 'appuser' group
|
| 22 |
+
# -m: Create the user's home directory
|
| 23 |
+
# -s /bin/bash: Set the default shell for the user
|
| 24 |
+
# -g appuser: Set the primary group for the user
|
| 25 |
+
RUN useradd --system -m -s /bin/bash -g appuser appuser
|
| 26 |
+
|
| 27 |
+
# Switch to the new user
|
| 28 |
+
USER appuser
|
| 29 |
+
|
| 30 |
+
# Set environment variables for the user (optional)
|
| 31 |
+
ENV HOME=/home/appuser
|
| 32 |
+
|
| 33 |
+
|
| 34 |
# Install nvm (Node Version Manager) and then use it to install Node.js and npm
|
| 35 |
# This ensures a clean and controlled Node.js/npm environment
|
|
|
|
| 36 |
ENV NVM_DIR /nvm
|
| 37 |
+
RUN mkdir -p $NVM_DIR
|
| 38 |
ENV NODE_VERSION 20.17.0
|
| 39 |
# Specify a compatible Node.js version, matching the earlier error message's requirement
|
| 40 |
|
|
|
|
| 52 |
# Verify Node.js and npm versions
|
| 53 |
RUN . "$NVM_DIR/nvm.sh" && node -v && npm -v
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Set all cache directories to /tmp (writable)
|
| 57 |
ENV HF_HOME=/tmp/hf_cache
|
start_with_sync.sh
CHANGED
|
@@ -22,6 +22,15 @@ echo "Data directory: $DATA_DIR"
|
|
| 22 |
echo "HF Repository: $HF_STORAGE_REPO"
|
| 23 |
echo "HF Cache: $HF_HOME"
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Create all necessary directories
|
| 26 |
mkdir -p "$DATA_DIR" "$HF_HOME" "$STATIC_DIR" "$UPLOAD_DIR"
|
| 27 |
|
|
@@ -117,11 +126,7 @@ git clone https://github.com/waxz/gemini-cli-openai /tmp/gemini-cli-openai
|
|
| 117 |
|
| 118 |
git clone https://github.com/snailyp/gemini-balance.git /tmp/gemini-balance
|
| 119 |
|
| 120 |
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 121 |
-
source $HOME/.local/bin/env
|
| 122 |
|
| 123 |
-
uv venv /tmp/.venv
|
| 124 |
-
source /tmp/.venv/bin/activate
|
| 125 |
uv pip install -r /tmp/gemini-balance/requirements.txt
|
| 126 |
|
| 127 |
|
|
|
|
| 22 |
echo "HF Repository: $HF_STORAGE_REPO"
|
| 23 |
echo "HF Cache: $HF_HOME"
|
| 24 |
|
| 25 |
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 26 |
+
source $HOME/.local/bin/env
|
| 27 |
+
|
| 28 |
+
uv venv /tmp/.venv
|
| 29 |
+
source /tmp/.venv/bin/activate
|
| 30 |
+
uv pip install --no-cache-dir \
|
| 31 |
+
huggingface_hub \
|
| 32 |
+
datasets
|
| 33 |
+
|
| 34 |
# Create all necessary directories
|
| 35 |
mkdir -p "$DATA_DIR" "$HF_HOME" "$STATIC_DIR" "$UPLOAD_DIR"
|
| 36 |
|
|
|
|
| 126 |
|
| 127 |
git clone https://github.com/snailyp/gemini-balance.git /tmp/gemini-balance
|
| 128 |
|
|
|
|
|
|
|
| 129 |
|
|
|
|
|
|
|
| 130 |
uv pip install -r /tmp/gemini-balance/requirements.txt
|
| 131 |
|
| 132 |
|