Compare commits
5 Commits
5cf3fa0318
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d4f9cf5c9 | ||
|
|
ba315bb95d | ||
|
|
77a759a3a1 | ||
|
|
768b045ab0 | ||
|
|
2e1f4f8800 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
workspace/
|
workspace/
|
||||||
config/
|
config/
|
||||||
|
root/
|
||||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +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
|
||||||
|
```
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
services:
|
services:
|
||||||
code-server:
|
code-server:
|
||||||
image: lscr.io/linuxserver/code-server:latest
|
image: lscr.io/linuxserver/code-server:latest
|
||||||
@@ -13,7 +12,8 @@ services:
|
|||||||
- ./config:/config
|
- ./config:/config
|
||||||
- ./init.d:/init.d
|
- ./init.d:/init.d
|
||||||
- ./workspace:/workspace
|
- ./workspace:/workspace
|
||||||
- /var/run/user/1000/docker.sock:/run/docker.sock
|
- ./root:/root
|
||||||
|
- /var/run/user/1000/docker.sock:/var/run/docker-host.sock
|
||||||
ports:
|
ports:
|
||||||
- 58333:8443
|
- 58333:8443
|
||||||
- 58322:22
|
- 58322:22
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ addpath /command
|
|||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
/usr/sbin/sshd -D &
|
/usr/sbin/sshd -D &
|
||||||
|
dockerd &
|
||||||
|
|
||||||
# Wait for the Docker readiness notification, if any
|
# Wait for the Docker readiness notification, if any
|
||||||
|
|
||||||
@@ -37,7 +38,6 @@ if read _ 2>/dev/null <&3 ; then
|
|||||||
exec 3<&-
|
exec 3<&-
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Now we're good: s6-overlay-suexec is accessible via PATH, as are
|
# Now we're good: s6-overlay-suexec is accessible via PATH, as are
|
||||||
# all our binaries.
|
# all our binaries.
|
||||||
# Run preinit as root, then run stage0 as the container's user (can be
|
# Run preinit as root, then run stage0 as the container's user (can be
|
||||||
|
|||||||
@@ -3,18 +3,34 @@ set -euo pipefail
|
|||||||
|
|
||||||
apt update
|
apt update
|
||||||
|
|
||||||
apt install -y openssh-server vim ca-certificates curl gnupg
|
apt install -y openssh-server vim ca-certificates curl gnupg iputils-ping
|
||||||
|
|
||||||
|
# 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 Docker CLI only (docker-ce-cli) from official Docker repo.
|
||||||
install -m 0755 -d /etc/apt/keyrings
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
|
||||||
chmod a+r /etc/apt/keyrings/docker.asc
|
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh
|
||||||
ARCH="$(dpkg --print-architecture)"
|
|
||||||
. /etc/os-release
|
# Add abc user to docker group
|
||||||
echo "deb [arch=${ARCH} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${VERSION_CODENAME} stable" \
|
usermod -aG docker abc
|
||||||
>/etc/apt/sources.list.d/docker.list
|
|
||||||
apt update
|
|
||||||
apt install -y docker-ce-cli
|
|
||||||
|
|
||||||
mkdir -p /run/sshd
|
mkdir -p /run/sshd
|
||||||
|
|
||||||
@@ -35,25 +51,5 @@ if [[ -f "${SCRIPT_DIR}/authorized_keys" ]]; then
|
|||||||
install -m 600 "${SCRIPT_DIR}/authorized_keys" /root/.ssh/authorized_keys
|
install -m 600 "${SCRIPT_DIR}/authorized_keys" /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp init.sh /init
|
# Copy init.sh to /init
|
||||||
|
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
|
|
||||||
Reference in New Issue
Block a user