Document nvm install and add proxy setup

This commit is contained in:
ub
2026-02-06 08:30:37 +08:00
parent 768b045ab0
commit 77a759a3a1
3 changed files with 24 additions and 23 deletions

View File

@@ -1,3 +1,7 @@
```shell
docker exec -it code-server /init.d/run.sh
```
```shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
```

View File

@@ -1,4 +1,3 @@
---
services:
code-server:
image: lscr.io/linuxserver/code-server:latest

View File

@@ -5,6 +5,25 @@ apt update
apt install -y openssh-server vim ca-certificates curl gnupg
# Configure system-wide proxy for this container.
PROXY_URL="http://10.8.0.1:7890"
cat >/etc/apt/apt.conf.d/99proxy <<EOF
Acquire::http::Proxy "${PROXY_URL}";
Acquire::https::Proxy "${PROXY_URL}";
EOF
cat >/etc/profile.d/proxy.sh <<EOF
export http_proxy="${PROXY_URL}"
export https_proxy="${PROXY_URL}"
export no_proxy="localhost,127.0.0.1"
EOF
# Configure git proxy if git is available.
if command -v git >/dev/null 2>&1; then
git config --system http.proxy "${PROXY_URL}"
git config --system https.proxy "${PROXY_URL}"
fi
# Install Docker CLI only (docker-ce-cli) from official Docker repo.
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
@@ -36,24 +55,3 @@ if [[ -f "${SCRIPT_DIR}/authorized_keys" ]]; then
fi
cp /init.d/init.sh /init
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
# Configure system-wide proxy for this container.
PROXY_URL="http://10.8.0.1:7890"
cat >/etc/apt/apt.conf.d/99proxy <<EOF
Acquire::http::Proxy "${PROXY_URL}";
Acquire::https::Proxy "${PROXY_URL}";
EOF
cat >/etc/profile.d/proxy.sh <<EOF
export http_proxy="${PROXY_URL}"
export https_proxy="${PROXY_URL}"
export no_proxy="localhost,127.0.0.1"
EOF
# Configure git proxy if git is available.
if command -v git >/dev/null 2>&1; then
git config --system http.proxy "${PROXY_URL}"
git config --system https.proxy "${PROXY_URL}"
fi