File size: 1,944 Bytes
8224768 e41bdbc 8224768 4deff3b 9809a1c 4deff3b 1bbb31b 4deff3b 8224768 e41bdbc 8224768 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
#!/bin/bash
NGX_NAME="${NGX_NAME:-admin}"
NGX_PASS="${NGX_PASS:-admin}"
CRYPTPASS=`openssl passwd -apr1 ${NGX_PASS}`
PORT="${PORT:-8080}"
echo "USERNAME:" $NGX_NAME
echo "PASSWORD:" $NGX_PASS
echo "${NGX_NAME}:${CRYPTPASS}" > ngpasswd
COMMIT=$(cat /app/openvscode-server/product.json | awk '/commit/{print $4;exit}' FS='[""]')
sed -i "s/#COMMIT#/$COMMIT/" nginx.conf
sed -i "s/#PORT#/$PORT/" nginx.conf
nginx -c $PWD/nginx.conf
set +e
if [[ ! -z "$REPOS" ]]; then
for REPO in $(echo $REPOS | tr ";" "\n")
do
dir=$(basename "$REPO" .git)
echo start to clone initial repo $REPO into $dir
git clone --recurse-submodules -j8 --progress $REPO $dir
cd $dir
[[ -z $(git config user.name) ]] && git config --global user.name "$(git log -1 --pretty=format:'%an')"
[[ -z $(git config user.email) ]] && git config --global user.email "$(git log -1 --pretty=format:'%ae')"
if [[ -e requirements.txt ]]; then
pip install --no-cache-dir --upgrade -r requirements.txt
fi
if [[ -e package.json ]]; then
npm i
npm run build
fi
if [[ -e ecosystem.config.js ]]; then
echo use pm2 start
pm2 start ecosystem.config.js
fi
cd ..
done
fi
[[ -z $(git config --global user.name) ]] && git config --global user.name "$SPACE_AUTHOR_NAME"
[[ -z $(git config --global user.email) ]] && git config --global user.email "$SPACE_AUTHOR_NAME@hf.co"
git config --global http.postBuffer 524288000
git config --global push.default current
echo "Starting VSCode Server..."
vscode=/app/openvscode-server/bin/openvscode-server
vscode_cli=/app/openvscode-server/bin/remote-cli/openvscode-server
$vscode --install-extension ms-toolsai.jupyter
$vscode --install-extension ms-python.python
ln -s $vscode_cli $(dirname $vscode_cli)/code
tslab install --prefix /home/user/miniconda/
set -e
pm2 start ./auto-commit.js
exec $vscode --host 0.0.0.0 --port 5050 --without-connection-token \"${@}\" --
|